0

I am wondering is there anyway to open terminal always with sudo privileges. And is there a way to open specific file with sudo privileges like windows have "run as administrator".

imposter
  • 453
  • 1
  • 5
  • 21
  • 4
    be careful what you wish for is the best advice... – graham Jun 24 '21 at 18:11
  • What are you trying to say @24601 – imposter Jun 24 '21 at 18:12
  • Does this answer your question? [How do I start Nautilus as root?](https://askubuntu.com/questions/156998/how-do-i-start-nautilus-as-root) – user68186 Jun 24 '21 at 18:40
  • no@user68186 i am asking something else – imposter Jun 24 '21 at 19:13
  • 1
    There is a reason there is no "run as administrator" option in Linux. This reason is security. You don't *need* root privileges unless you change system settings, and you always need to type your password to do that. This keeps your system secure. – Bernt Ribbum Jun 24 '21 at 19:35

1 Answers1

3

To always open a terminal as root is not a good idea, but, hey, it is your computer and we hope you will act responsibly.

Edit your .bashrc file and add sudo -i to the end. Then, anytime you launch the terminal, it will always start with the prompt for the [sudo] password, and drop you to a prompt with root privileges when you successfully entered the password.

With respect to opening a specific file, there is an extension for the file manager Files (aka nautilus) that allows to open a new file manager window, or edit a file with root privileges. It is available in the package nautilus-admin.

vanadium
  • 82,909
  • 6
  • 116
  • 186
  • 3
    Why was this downvoted? It's a perfectly valid answer to the question. Is it a security concern? Maybe, but not more than typing `sudo -i` as soon as you enter your terminal. Is this a bias because someone thinks they know better how a particular user should use their own system? – Artur Meinild Jun 24 '21 at 19:48