12/11/2023 0 Comments Sudo su run commandHaving a "shared" account in the middle completely undermines this. The whole point of sudo is to directly associate the person logging in with the sudo'd commands they execute. connect to the unpriviliged user first by ssh-key, then su to the sudo priviliged user and then sudo -i/sudo su to the root account and execute the commands. It seems to me that their is a problem with the combination of ssh -t and sudo -S, but I don't get it. If I execute this command directly on the machine it works, but as soon as I try it over ssh, it throughs the error: su: invalid option - 'S' I thought about something like this: ssh -t su user02 -c 'sudo -S cat /etc/shadow' ![]() My question is if something like this is possible without Python too.Īt the end I want to execute a script, which reads the priviliged user password and then executes commands as root user on the remote system. One solution, which looks very convinient to me is using Python with Paramiko The manual way, which works, is to connect to the unpriviliged user first by ssh-key, then su to the sudo priviliged user and then sudo -i/sudo su to the root account and execute the commands. The Problem is: The environment doesnt allow to access the root user directly. ![]() Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.My goal is to execute commands as root user from another linux host through ssh. Just use those commands with caution, so you don’t wind up wreaking havoc on your Linux desktop or server. ![]() However, if there’s a command you must run, and it fails with a minimal sudo command, either sudo – or sudo su – will always work. Most often, you’ll only have to run basic sudo or su commands. If you issue the command sudo su, you switch to the root user without resetting the environment variables, so you have the root user privileges, but not the environment. bashrc files by root, but only if the user running the command is defined in the /etc/sudoers file, effectively becoming the root user, even if the root user is disabled, such as it is in Ubuntu. If you run the command sudo su – you will switch to the root user which will then execute all /etc/profile. If you use just sudo, you execute a command with admin privileges. SEE: Linux file and directory management commands (TechRepublic Premium) Execute the command su – and you invoke a login shell after switching the user, which resets most environment variables, providing a clean base. If you issue the command su, you switch your user to root, which then executes only the. There are different ways to use sudo and su. New Malware Targets 97 Browser Variants, 76 Crypto Wallets & 19 Password Managers How Generative AI is a Game Changer for Cloud Security Must-read security coverageĨ Best Penetration Testing Tools and Software for 2023Ħ Best Cybersecurity Certifications of 2023 Even though most every Linux distribution uses sudo, some of them (such as Fedora and openSUSE) allow you to su (switch user) to the super user account–otherwise known as root. Sudo stands for “super user do” and allows standard users to take admin-level actions, such as installing software. ![]() If you’re a new Linux admin, you probably at least know about sudo.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |