![]() ![]() Then your script can be readable, but your password file can't be. ![]() More indirectly, you can store your password in a file and cat it to sudo. Make sure the script is only readable by yourself, as your password is in it. The sudo command is to execute one command with permissions of any user. To edit it and add rules you need to use the visudo command. The default sudoers file is located here: /usr/local/etc/sudoers. If the user executing su isn't the root, he have to enter the password of the user he want get identity. Installation instructions are here, titled: FreeBSD: Install sudo Command To Execute A Command As The Root. Cú pháp trên bao gm: Username: Tên ngi dùng. Cú pháp ca dòng sudo c cu hình là: Username Machinename (Effectiveuser) command. Run the script from your own account and use the -S option of sudo like this: echo | sudo -S su -l or even better: echo | sudo -S su -l -c ''. The su command it to temporary change an identity to any user on a system and execute many programs with his/her/its permissions. Mt sudo c cu hình úng cách rt linh hot và s lng các lnh cn c chy có th c cu hình chính xác.Run the script from cron (or any variant thereof) and run it as root.Your next question is probably how to pass a password in an unattended script, which doesn't require user input. sudo su shows (assuming bash): +───bash───su───bash You can see the difference if you look at the process tree. This isn't a security issue, as the shell process can't escalate to the privileges of the parent process. In terms of privileges, there is no difference for the shell that is opened by sudo su or by su. After that it will start a shell for user someuser. It will however ask for your password to verify your sudo rights. sudo su Chris Klosowski on JI’ve always wondered this but finally got the answer as to why you should use: sudo su instead of using: sudo su When adding the ‘-‘ character to the end of this command, you are also put into the PATH of the superuser. So it doesn't ask for someuser's password. sudo su executes su with root privileges.In other words, the tool lets you assume the identity of some other user without having to logout and then login (as that user). The main work of the su command is to let you switch to some other user during a login session. sudo asks for your password and (assuming you have sudo rights) executes a command with root privileges ( sudo reboot asks for your password and reboots the computer). In this article, we will discuss in detail the ‘su’ command as well as how it differs from the ‘sudo’ command.su (without username) start a shell for user root (after asking for the root password).Unless you're root, you'll be asked the password for someuser. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |