Linux Terminal 101: How to Change Your Identity – HakTip

 

 

“There are three ways to change your identity. Log back in as another user, the su command, or sudo. su lets you start a new shell session as that user or issue a single command as that one. sudo can define specific commands that a user can use. The choice depends mainly on the OS you’re using- as each one works a little differently. To start shell as another user, the syntax is su [-[l]] [user].-l will create a login shell for that user. -l can be seen as just -. So to change to superuser status you would type su -, then your password. Now you’ll see ‘root’ in place of the username. Always remember to use ‘exit’ to resume using the OS as a normal user. You can also type su -c ‘command’ to run just one single command as a superuser. Ex: su -c ‘ls -l /root/*’.

An admin can allow users to execute certain commands with sudo. For example, sudo ducky_script, then typing your password, will let you as a regular user run the ducky_script as a regular user. sudo -l will show you what privileges you have.

You can also use chown to change the owner or group owner of a file. It looks like this: chown [owner] [:[group]] file.. . If the argument looked like this: shannon:users it would change the ownership from its current one to shannon, and the group to users. :admins would change the group owner to admins, but the file owner is the same. So if I wanted to change the ownership from me to Darren, I would put sudo chown darren: ~darren/example.txt.

Now that you know some of the reasons why we have passwords for users, lets change those passwords. Use the syntax passwd [user]. To change it, type passwd. Type your current password, and the new one. passwd will make you use a strong password, so it’ll deny crappy ones. Check out the passwd man page for more options for this command.

Make sure to email me tips@hak5.org with your thoughts. And be sure to check out our sister show, Hak5 for more great stuff just like this. Don’t forget to check out our new show Threat Wire, for internet privacy and security news at youtube.com/techfeed. I’ll be there, reminding you to trust your technolust.”

Comments are closed.