![]() ![]() As a normal user, you can't, for instance, delete the configuration file that defines your network interfaces or accidentally overwrite your list of users and groups. Running your system as a normal user is a self-imposed limitation that protects you from silly mistakes. After that initial interaction, you're expected to log in as a normal user. Using the root account, you log in and create secondary "normal" users. Since sudo can pretty much do everything that su can, I would say it is best to stick with sudo unless you are working with some legacy codes that require the su command.On traditional Unix and Unix-like systems, the first and only user that exists on a fresh install is named root. sudo will ask for your password, while su will ask for the password for the user whom you are switching toīut when do you use one, not another? Since the sudo policy is defined in /etc/sudoers, this can give powerful permission controls.Just typing su switches to the root user.su means to switch to a particular user.sudo -i brings you to an interactive session as root.You need to have an entry in /etc/sudoers to execute these restricted permissions.sudo lets you issue commands as another user without changing your identity.The ( -) switch has the same effect as logging into a system directly with that user account. If you want to switch to the bryant user account including bryant's path and environment variables, use the ( -) switch: $ su - bryant $ su bryantįor the second example, you are switching to bryant, and so you need bryant's password unless you are root. The ( -) switch provides you with root's environment (path and shell variables) rather than simply giving you root user power for a single command while keeping your own environment. In the above example, you are switching to root and you need the root password. Most often, the user account you switch to is the root account but it can be any account on the system. You are basically switching to a particular user and you need the password for the user you are switching to. Su, on the other hand, is an acronym for switch user or substitute user. The theory behind using sudo is that the act of issuing the sudo command before any command you run makes you think more about what you're doing and hopefully make fewer mistakes with an account that possesses unlimited power. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |