Another way to gain root permissions on a Debian Linux installation.

Posted: November 21, 2017. At: 6:00 AM. This was 2 months ago. Post ID: 4880
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

Colossus; the first working digital computer.
Colossus; the first working digital computer.

This is another way to gain root permissions on a Debian system; this is a script that will elevate the user to root for a specific command; like using the sudo command.

su-to-root -X -c "cat /etc/shadow"

This is what you get if you try this without root permissions.

[flynn@flynn-grid-runner ~]$ su-to-root -p flynn -c "cat /etc/shadow"
cat: /etc/shadow: Permission denied

This command only seems to work if you execute it in a terminal window where you have previously executed the sudo command. But I thought I would put this command here anyway.

Another way to get root permissions and gain a permanent root prompt is to use this command.

[flynn@flynn-grid-runner ~]$ sudo su -
flynn-grid-runner ~ #

Then you have a proper root prompt; but you have to remember that the root account can perform any task on your machine and you need to be careful what you are running. As shown below you may also use the sudo -s command to gain root permissions. But this did not give me the distinctive colored root prompt; only the hash symbol at the end of the prompt that defines it as a root prompt; so be careful when using this command.

[flynn@flynn-grid-runner ~]$ sudo -s
bash: #!/bin/bash: No such file or directory
[root@flynn-grid-runner flynn]#

No comments have been made. Use this form to start the conversation :)

Leave a Reply