| Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
You... ish.
$ whoami # your username
$ who # who is logged in?
$ w # who is here and what are they doing?
$ id # user ID, group ID, and groups you're in
Sometimes robots are users too: Apache, Mailman, ntp.
/etc/passwd:
root:x:0:0:root:/root:/bin/bash
username:password:uid:gid:uid info:home directory:shell
$ su $USER # become user, with THEIR password
$ su # become root, with root's password
$ sudo su - # use your password instead of root's
$ sudo su $USER # become $USER with your password
Act as themselves.
- ls -l to see file permissions.
- Check the file’s group and user.
- Check the file’s read, write, and execute bits.
$ cat /etc/passwd
# username:x:UID:GID:GECOS:homedir:shell
$ useradd <user_name> # vs adduser, the friendly Ubuntu version
$ userdel <user_name>
$ passwd
$ groupadd
$ usermod
$ groupmod
$ cat /etc/group
root:x:0:
[foo@compe ~]$ yum install httpd # Runs command as `foo` user
Loaded plugins: fastestmirror, ovl
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/__db.002'
You need to be root to perform this command.
[foo@compe ~]$ sudo yum install httpd # Runs command as `root` user.
password:
Loaded plugins: fastestmirror, ovl
[... installs correctly ...]
Warning
Acting as root is dangerous! You can accidentally delete your filesystem, forcing you to completley re-install your OS! Type carefully.