![]() su lets you switch user so that youre actually logged in as root. I've always wondered why this is so commonly suggested in the Ubuntu world. muru at 7:59 1 There is never a good reason to run sudo su. Su will switch you to another user environment will open a session of that user, and you will become that user, it can be root or any other, sudo will upgrade your privileges and let you run commands as root, provided you have the rights, that is you are listed in sudoers file. sudo lets you run commands in your own user account with root privileges. 1 muru The OP is asking difference between su and sudo su not sudo -s or sudo -s Maythux at 7:58 2 NewUSer read again. That will ask user's password and then run ls command as root, you have to configure the sudoers fileĪs you can see, one can achieve same goal (run privileged commands) with both su and sudo they work in different ways and they are made for different things, it is up to you to use the most appropriate command deppending on your needs and general scenario. Sudo is a different beast, if you want to give some users access to perform some tasks as root without given them root's password, you will have to use sudo command, in this case those users just have to enter their own passwords and run something like this: sudo ls / You can try using sudo sudo-V less as a regular user or just sudo -V. Will switch you to root, you will have to know root's password You are running as a regular user and need to sudo several commands at once. Will switch your current user to john, provided you know john's password, if you want to get all environment variables that john get when he logs in you can use: su - johnĪfter that you can run commands in john's environment su. sudo is more secure that su, as sudo uses users password (note only those with appropriate privileges can use sudo), therefore we do not have to distribute a new root password every time someone leaves the group. In few words su command switches user, from your current user to any other one, it may be root or not su john ElectricCoffee Both are unsafe: Having a root shell is unsafe One slip of the fingers can cause a lot of damage. The optional argument - may be used to provide an environment similar to what the user would expect had the user logged in directly Invoked without a username, su defaults to becoming the superuser. The su command is used to become another user during a login session. ![]() If a normal user needs to perform any system wide changes. normal users are not authorized to perform any system operations. One of the way to implement security in Linux is the user management policy and user permission. Linux System is much secured than any of its counterpart. ![]() ![]() With Linux like with most things in life you have different ways to accomplish a specific task, this is the case of su and sudo they are different commands with different goals but they are usually used one instead the other. Difference Between su Vs sudo and How to Configure sudo in Linux. Two different commands that can be easily confused with each other: 1. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |