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

Posted: November 20, 2012. At: 11:49 PM. This was 5 years ago. Post ID: 4880

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.

[[email protected] ~]$ 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.

[[email protected] ~]$ 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 coloured 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.

[[email protected] ~]$ sudo -s
bash: #!/bin/bash: No such file or directory

[[email protected] flynn]#

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

Leave a Reply