![]() Su optionally lets you add a lone dash before the account name to have it run a login session but for a service account, this probably does not make sense. Where obviously you need to create otheraccount and make sure it has the privileges that are required for performing this particular task. Ideally, you might want to make sure that my_prog runs on a dedicated unprivileged system account then, the syntax would be su otheraccount -c /path/my_prog Running a shell makes sense when you actually require shell features such as wildcard expansion, redirection, etc, or shell builtins like cd. Sh -c "command" is just an inefficient way to run command. Sudo makes sense if you are running on an unprivileged account, and have been granted the rights to switch to another account (often, but not always, root), usually with the requirement to be able to interactively supply your password (though this can be turned off if you really have to obviously, you need to understand what you are doing before you mess with security-related stuff). Su makes sense if you are root and want to switch to a different account. The correct answer is to simply run your command. Additionally, each time a user should no longer use the root account (for example, an employee leaves), the system administrator will have to change the root password.You don't need any of them rc.local runs with root privileges. Provide too much power for inexperienced users, who could unintentionally damage the system. It's not good practice to have numerous people knowing and using the root password because when logged in as root, you can do anything to the system. Using su creates security hazards, is potentially dangerous, and requires more administrative maintenance. To do so, press Ctrl-d or type exit at the command prompt. If you supply a user, you will be logged in as that account until you exit it. In either case, you'll be prompted for the password associated with the account for which you're trying to run the command. The user feature is optional if you don't provide a user, the su command defaults to the root account, which in Unix is the system administrator account. Replace user with the name of the account which you'd like to run the commands as. 18 When you have a server of some sort you can access it through, e.g., ssh user1ip and you can also do ssh rootip to go to your root user with su priveleges and then go to su user1. To switch users before running many commands, enter: su user ![]() Replace user with the name of the account which you'd like to run the command as, and command with the command you need to run as another user. To use the su command on a per-command basis, enter: su user -c command The su command allows you to become another user. For more information about the sudo command, visit A. 28 (530 votes) Do you prefer su or sudo Both the su and the sudo commands allow users to perform system administration tasks that are not permitted for non-privileged usersthat is, everyone but the root user. The sudo command also makes it easier to practice the principle of least privilege (PoLP), which is a computer security concept that helps control system access and potential system exploits and compromises. 18 (333 votes) sudo 54 (1009 votes) It depends. Replace command with the command for which you want to use sudo. ![]() To use the sudo command, at the command prompt, enter: sudo command It also logs all commands and arguments so there is a record of who used it for what, and when. Using the sudoers file, system administrators can give certain users or groups access to some or all commands without those users having to know the root password. It prompts you for your personal password and confirms your request to execute a command by checking a file, called sudoers, which the system administrator configures. When elevating privilege, we need to enter the root password.WARNING: Never give the root password to a normal user. ![]() The sudo command allows you to run programs with the security privileges of another user (by default, as the superuser). Ever wondered whats the difference between su and sudo In this video, youll learn all about the differences of the switch user(su) and switch user and do(. In Linux, we can use either su or sudo to temporarily grant root access to a normal user. The Unix commands sudo and su allow access to other commands as a different user. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |