0

I am running a Raspberry Pi 3 Model B and I am trying to find out what my administrative privileges are.

When I start up the pi I have started it in the standard mode after boot. I have not changed any settings at all or removed or installed any programs. When I try and open a folder called lost+found I get the following error

Error operningf directory '/lost+found': Permission denied

I have used the groups command and I get the following message

pi adm dialout cdrom sudo audio video plugdev games user input netev gpio i2c spi

My Question: Is there any way of viewing your user privileges and changing them to full administrative so I am able to access this folder.

3

POSIX systems such as GNU/Linux use root filesystems where each file has mandatory permissions set on it.

The superuser (aka. root) on such a system can access anything. Raspbian exploits the sudo application to do something which would normally be considered moronic, since it short circuits a basic tenant of the permissions system, which is that a normal user used to e.g., browse the web, should not have permission to do anything. But via sudo the pi user can. It's implicit in this that the default Raspbian configuration assumes:

  • That anyone who uses the system as is has no real security concerns: Your pi is connected to your LAN and is a toy device.

  • That the user is unfamiliar with file permissions, etc., and doing this makes it easy since you do not have to learn much about it, you just have to use sudo.

Is there any way of viewing your user privileges and changing them to full administrative so I am able to access this folder.

You already have that as much as it is possible, you just have to use sudo. Via this you can read and change permissions/ownership (see man chmod and man chown) on anything.

There are a couple of gotcha's, such as the fact thatsudo does not work across shell redirection. However, you should be able to use su (switch user) to become root (i.e., su root). If this does not work you may need to set a root password first via sudo passwd root. Beware this is not the same as user pi's password.

3

By default, if you're not root, you're not "administrator". You can enter whoami at the command prompt to see who you're logged in as. If your user is a member of the sudo group (assuming you're running raspbian), you can execute commands as root using sudo. To see what groups your current user is a member of, enter groups at the command prompt.

This can all be customized, so all bets are off if you're using something than a stock raspbian configuration.

  • It says that I am running as pi, how do I change this to running as administrator so I can access my files? See Update for groups – Jake Symons Dec 3 '17 at 19:26
  • @JakeSymons running everything as root and allowing root to login are major security issues, rather do as bobstro said and prepend the command with sudo. – Steve Robillard Dec 3 '17 at 19:29
  • And how would I go about doing this. I have tried to type in sudo root as that appear too be the instructions above but I get the message saying command not found. – Jake Symons Dec 3 '17 at 19:32
  • 1
    @JakeSymons it is not sudo root it is sudo <command> so to do a directory listing you would do sudo ls or to change to a directory sudo cd lost+found. Since you seem very new to this I suggest you read the sudo man page using the following command man sudo. You might also want to read this learnenough.com/command-line-tutorial – Steve Robillard Dec 3 '17 at 19:57
  • 1
    It might help if you'd edit your question to explain what you're actually trying to accomplish rather than us try to guess line-by-line. You can get a root shell with sudo -i, but if you're learning, be very careful as it's easy to do permanent damage to your installation. If you are following instructions, and they assume you're root, they're either weak instructions, or meant for a higher skill level. – bobstro Dec 3 '17 at 20:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.