11/28/2023 0 Comments Sudo su run commandThen you would call from the terminal: sudo -u user2 /Applications/Skype. I assume you have Skype installed in your Applications folder: user1 ALL=(user2) NOPASSWD: /Applications/Skype.app/Contents/MacOS/Skype The following example works on computers with macOS installed. From a sudo bash shell they can run any admin command, install or delete software, delete users and directories, etc. Letting someone run sudo bash is equivalent in most ways to having the root password. You could consider adding Skype directly to the sudo's configuration file. To run commands with superuser privileges, use the sudo command. It will either give them root privileges or give them a focused app to attack to get root privileges. I have just seen your comment regarding Skype. If you want to be able to switch to any user just use user1 ALL=(ALL) NOPASSWD: /bin/bash To run a command as the root user, use sudo command. You can replace also /bin/bash by ALL and then you could launch any command as user2 without a password: sudo -u user2. To see the commands that are available for you to run with sudo, use sudo -l. So you navigate at the end of the file and add this: user1 ALL=(user2) NOPASSWD: /bin/bash This is where you need to add the new line. This file is structured in different section, the aliases, then defaults and finally at the end you have the rules. You usually need super user privilege for visudo: sudo visudo Another command line editor sometimes regarded as easier is nano, so you would do export EDITOR=/usr/bin/nano. Note: this command will open the configuration using the vi text editor, if you are unconfortable with that, you need to set another editor (using export EDITOR=) before executing the following line. Heres how a typical sudo command is run: Read the. To configure sudo, you must edit its configuration file via: visudo. When you open command prompt, you can now run something like sudo start. Adding the sudo keyword before a command instructs the operating system to execute it as the root user. Ssh does not need password because we use authorized_keys, BUT Password-less sudo is not an option nor using su directly (I'm not root and cannot change that), the command needs to be "sudo su - oracle" exactly.It needs a bit of configuration though, but once done you would only do this: sudo -u user2 -sĪnd you would be logged in as user2 without entering a password. Restrictions: I cannot use expect, it’s not installed in my machines. echo passwordsudo -S su - user-to-switch sudo -S su - user-to-switch The above command still ask for the password. Try the same command with sudo: sudo apt-get update 4. You do not have the necessary permissions to run the command. How can I combine thoses commands in a shell script (or even perl one), execute it and then leave myself at a prompt so I can run sqlplus after? Is that even possible? su -c 'commandtorestarttheservices' -s /bin/sh abc.xyz I am able to run the command successfully. Open a terminal window, and try the following command: apt-get update 2. I tried the command (based on the links above) but that does not work : ssh -t myserver "echo password | sudo -S su - oracle bash export ORAENV_ASK=NO" I'm trying to automate the following sequence to log in to the database $ ssh sudo su - export export. SSH to server, Sudo su - then run commands in bashĬan I ssh somewhere, run some commands, and then leave myself a prompt? I have already looked at the following links but didn't managed to make it work:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |