1

I'm very new to linux (specifically Ubuntu 14.04) and it's been 20 years since I worked on a unix system. Even back then, my command line tasks were rare enough that I had a series of Post-It notes with command sequences to help me out. I'm learning Ubuntu to help with some open source projects I'm working on. Honestly, I'm finding linux a bit frustrating coming from a Windows command line / batch file / Powershell world. Enough background for now...

my command prompt has changed back and forth beween root@serverName and user@serverName but I'm not sure how or why. I also noticed that some directories are not accessible but definitely exist and I lack permissions to write in some other folders.

What do the different usernames at the command prompt mean and how do I keep track of which folders I can read/write? References are appreciated as I'm not opposed to digging but I don't even know what to look for at this point.

Thanks!

3 Answers 3

1

Your command-line prompt is defined in the startup script of the shell (bash by default, but YMMV); the default in Ubuntu is to set it to $USER@$HOST, in other words, the user@servername you are looking at.

You normally log in to your user on an Ubuntu machine; this user has relatively low privileges --- reading world readable files, reading/writing their own files, using the public services (printers, etc.) but no configuring them. The "administrator" user in Unix machines is called root (aka superuser), and has all privileges --- it can do anything to the system. When you switch from your normal user to root, the prompt changes as a way to warn you.

To do the switch there have been traditionally two ways: one is to log in directly as root, and the other one is gaining privileges with a command like su or sudo (su stands for switch user). In Ubuntu the first method is frowned upon; normally the root user has no password at all and can't login directly.

The Ubuntu Way to get root permission is that a subset of users, the ones that are in the sudo or adm group, can switch to superuser "powers" by sudo -i. You can check with the command groups:

[romano:~] % groups
romano adm mail dialout cdrom sudo dip plugdev lpadmin sambashare vboxusers

(the group system is the Unix way to give partial privileges to user).

Look at this example for my prompt (this is not standard, I use liquidprompt):

enter image description here

For digging more, this unix tutorial is a good source of information.

0

In Linux, "superuser" privileges give you access to read and write any file on the entire system. You can gain superuser privileges by either logging in as a user called "root", or by using something like sudo.

Because it's designed to be able to be used by multiple users, and so no one of those users can mess up the system for everyone else, Linux has user accounts and keeps each users' own files separate and protected, so that only that user can modify them. Your files will be located in (by default), /home/username/. In addition to this, no regular user can modify "system" files such as the installed programs or their system-wide configurations.

If you need to do anything which affects the whole system, you'll probably need to use superuser privileges by logging in as root or using sudo. However, it's important to note that you should not normally log in as root or use sudo, and when you do so, you need to be extremely careful about what you are doing.

0

To answer your question "how do I keep track of which folders I can read/write" this is normally done on ubuntu and unix-like systems using the find command.

For example, here is a post at the unix and linux forums Searching File in Directory and all Subdirectory and Delete @ http://www.unix.com/shell-programming-and-scripting/255252-searching-file-directory-all-subdirectory-delete.html where the -user flag to the find command is used to perform a routine unix system admin take.

For more on the find command, visit this man page reference for find:

http://www.unix.com/man-page/linux/1/find/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .