33
Run command as not-root
(social.vivaldi.net)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
You can run commands as the new user from the root account.
su -c 'command' username
Enter the password for the new user when prompted.
This way at least the main account is still root and the command is being run without root privileges on the new users account.
@Rustmilian yeah, already tried it. The problem is that all of the apps in the instance are only installed for the root user (e.g. python and all it's libraries. So, when I use su -c all I get is a lot of command not found messages that would take a lot to solve. Besides I expect a lot more problems when the command needs access to some files and some processes (like a sql database) that would require me to do a lot of stuff to grant permissions to the new user. That would eventually work but given the work it requires I thought that some kind of "anti sudo" command or something like that could exist so I can still be the root user but pretend I am not a superadmin
There's a source that says something about using the AWS Systems Manager Session Manager by ""Configuring the necessary IAM permissions for your user or role to access the instance using Session Manager 1
Open the AWS Systems Manager console, navigate to the "Session Manager" page, and select the instance you want to access
Click on the "Start session" button to initiate the session with the instance.
Once the session is established, you can run commands as the root user without the need for sudo""
I'm unsure if this achieves exactly what you need though.