WebbI'm the IT Guy that you need in company to manage vendors, outsourcing and services. Technical guy, proxy between end user, business, … Webb-1 I am looking for a command to SSH to a server using root and then switch it to other user after executing SSH. Could someone please help me in providing the command for this. Not Working: ssh root@hostname `su - dba` Working: ssh root@hostname (prompting for password) Share Improve this question Follow edited Mar 18, 2015 at 20:51 …
Run part of a bash script as a different user
Webb10 dec. 2024 · If you want to run another shell instead of the one defined in the passwd file, use the -s, --shell option. For example, to switch to root and to run the zsh shell, you would type: su -s /usr/bin/zsh. To preserve the entire environment (HOME, SHELL, USER, and LOGNAME) of the calling user, invoke the command with the -p, --preserve-environment ... WebbIf there is a specific command you wish the script to be able to execute as root, while it's running as another_user then you should use sudo. Configure sudo to allow another_user to execute the specific command, something like this in your sudoers file, someuser ALL=/path/to/specific_command and then in your bash script use, pa wine and spirits lottery snpmar23
How to switch users & echo script outputs using shell script
Webb2 nov. 2024 · A simple command that can be used to switch users in shell scripting without using sudo. I’m looking for a script to switch user and execute specified commands in my computer. Neither my user nor the second user have no privileges for sudo. I’ve tried everything but seems su doesn’t accept input redirection, please help me, … WebbTo switch back to the previous user and the shell, you can use: # su -s /bin/bash golinux golinux@ubuntu-PC:~$ whoami golinux . 6. Execute a command as different user with su command. The -c or --command option is used to run the command as a different user without entering the interactive shell. $ su -c user. OR $ su --command ... WebbStorage configuring in Brocade switch. Working for RCA with Vendors Network Administration: - Switching, Routing and Firewall Backup … pa wine and spirits coraopolis