-1

I don't want to type sudo and my password everytime.I think it is really annoying.Is there any command or option which will consider you root user when you open terminal,everytime When you open terminal.

Braiam
  • 67,791
  • 32
  • 179
  • 269
4M01
  • 553
  • 2
  • 6
  • 16
  • 12
    Please, please, please do not do this. It is a horrible idea. – terdon Mar 18 '14 at 19:14
  • 5
    If you do this, anyone who presses is root. Any script that opens a terminal is root. Any silly command you type will be executed. You might as well run XP unpatched. – Marc Mar 18 '14 at 19:16
  • I am voting to close this question as a duplicate of one that shows you a more reasonable approach to not typing a password. That, at least, won't leave your system quite so unprotected. It is still a horribly silly thing to do but better than what you're asking for. – terdon Mar 18 '14 at 19:29
  • 4
  • @terdon: Will you explain what is horrible about it in a personal computer. Is there a threat from a hacker on the internet to become root or someone who has direct access to computer? – Minimus Heximus Mar 18 '14 at 19:56
  • @MinimusHeximus yes, both of the above. Also, any kind of buggy program you run will now have access to the system and can destroy it, any mistake you make can now destroy the system etc. – terdon Mar 18 '14 at 19:57
  • @terdon: a reason I'm using a linux OS is to be less careful about security, I'm thinking someone with a direct access to the PC can boot in with an Ubuntu Live CD and do anything in less than 15 minutes, and what can be interesting for a hacker from internet about a personal computers' system files assuming they can access personal files without a password? – Minimus Heximus Mar 18 '14 at 20:10
  • @MinimusHeximus if an attacker has physical access to a machine, then that machine is compromised, that is a given. If, however, you run everything as root, an attacker doesn't need physical access. If they break in, everything is wide open to them. Anyway, as I said, there are other dangers. For example, you can mistype something like rm /bin and that will break your system. All sorts of commands will be executable that can break your system. Also, any bug or malicious software you encounter can now break your system. – terdon Mar 18 '14 at 20:12
  • @MinimusHeximus as for why a hacker cares, two very simple reasons: 1) your bank details 2) using your computer as a platform or a stepping stone during an attack, making it part of a bot net etc etc. Seriously, this is a VERY bad idea. – terdon Mar 18 '14 at 20:13

2 Answers2

13

I am really against root being used as a default login. This is a really really really BAD idea.

However, in cases where I'm working on something that requires a root terminal session with lots of sudo commands again and again it can get tiring to type sudo.

You can create a root session using the sudo -i command and enter your password once. When you are finished with whatever operations require root you can then exit and get back to a user level account.

mcgarrah@localhost:~$ sudo -i
root@localhost:~# id
uid=0(root) gid=0(root) groups=0(root)
root@localhost:~# 

Again, running as root at all times is a really bad idea. Root allows for more access than a standard user needs and many of the features that make Linux more secure are no longer working for you. One example is running a web browser as root is insane.

4

Type:

sudo visudo

Go to the end of the file and type:

<username> ALL=NOPASSWD: ALL

Press Ctrl+X to exit, and press Y to save the changes.

Now open System Settings->Keyboard in that go to the Shortcut tab.

Launch terminal, press Space and Backspace; it will disable it.

Now go to Custom Shortcuts and click the plus (+) button at the bottom.

Give the name as terminal and the command as sudo gnome-terminal, then click Apply.

Then just go to some other location and come back to Custom Shortcuts.

Click terminal, press Space and now press Ctrl+Alt+T.

Close the window.

That's it!

Now whenever you open the terminal through Ctrl+Alt+T, it will open as root.

Enjoy!

PoNs
  • 101