I use Linux Mint 17.1 64-Cinnmaon (Virtual Machine in vmware workstation and Windows 8.1 host).
I have activated the root account to avoid permanently entering my password. I mainly play with the system and tweak things. Or I test some self written programs. My problem is that I cannot find a way to activate desktop shortcuts in the root account.
By the way, I couldn't care less about the security/privacy aspect as this is only a virtual machine to learn to find my way around with Linux. I have no problem to tweak the system or to install third-party software to achieve this.
UPDATE: 08.07.2016
While I don't use desktop shortcuts (expect the Trash can/bin) on any of my machines anymore, I still want to help those that still do. While you will have to enter some terminal commands and create a couple of scripts, you don't need to have any knowledge of either. It's straight forward copy and paste so don't worry.
First, I have found a better way to become root without actually using the root account. This has the advantage that you don't have to tweak programs like Google Chrome, Play on Linux or even Cinnamon (to actually display something as basic as desktop icons).
1. Getting rid of terminal password prompts
The first thing we need to get rid off are password prompts when using the terminal in combination with sudo (every time you want to install something or tweak your system (probably when something doesn't work)). So to do that, you want to enter the following command into the terminal:
Code: Select all
sudo visudo
Don't worry, the password prompt is supposed to appear.
Now go to the following lines:
Code: Select all
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
Code: Select all
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) NOPASSWD: ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL) NOPASSWD: ALL
press ctrl + x and type y when asked if you want to save. When you'll see a file path, just take the default by pressing enter.
Now you're finally freed of terminal password prompts. But don't forget, you'll still have to type sudo every time you want something executed as root, you'll just not be asked your password.
If you prefer to type a password once but leave away all the sudos and gksus, type the following into the terminal:
Code: Select all
sudo passwd
Now you can type:
Code: Select all
su
Code: Select all
sudo passwd
You have now become the root user in your current terminal instance.
Assigning the root user a password unlocks an other feature: start menu -> Administration- > Login Window -> Options -> Allow root login.
Remember, to login as root, you have to enter both username (=root) and the root password.
2. Getting rid of GUI/graphical password prompts
If you go to the start menu and there to Administration and then to Login Window, you'd find yourself facing a password prompt. So if you are the average Jo, these password prompts might annoy you even more than the terminal ones as they will annoy you every time you're gonna install a program.
So how to get rid of them? Well that's rather straight forward.
If you have closed the terminal, re-open it.
Then, type the following (Ubuntu users, please don't try this but see below):
Code: Select all
gksu nemo
OR
Code: Select all
gksu nemo
Code: Select all
sudo nemo
If your version of Linux Mint does not include gksu for some reason, don't worry:
Code: Select all
sudo apt-get install gksu
If you are a Ubuntu user, gksu is not included, therefore you'll have to install it first:
Code: Select all
sudo apt-get install gksu
Code: Select all
gksu nautilus
OR
Code: Select all
gksu nautilus
Use the file manager to navigate to the following location:
/etc/polkit-1/localauthority/50-local.d/
There, create an empty text file called: 99-nopassword.pkla
Code: Select all
Open the newly created file and copy the following text:
[No password prompt]
Identity=unix-group:sudo
Action=*
ResultActive=yes
3. Opening nemo/nautilus as root without using the terminal
Personally, I find finding files I need to modify easier by using the GUI instead of the terminal, especially if I don't know the exact file path and file name by heart. The problem: Only root can modify things outside your home folder. Changing permissions sounds good at first glance but it will break your system if not done right. Apart from that, you can't change those permissions without using the terminal, too.
So how to solve the problem?
By getting a shortcut which opens the root version of nemo/nautilus.
As you might have guessed by now, you'll need to open the terminal if you haven't already.
Enter:
Linux Mint:
Code: Select all
sudo nano /usr/share/applications/Nemo-root.desktop
Copy and paste the following lines into the terminal:
Code: Select all
[Desktop Entry]
Name=File Browser (Root)
Comment=Browse the filesystem with the file manager
Exec=gksudo nemo
Icon=file-manager
Terminal=false
Type=Application
Categories=Application;System;
Code: Select all
sudo nano /usr/share/applications/Nautilus-root.desktop
Copy and paste the following lines into the terminal:
Code: Select all
[Desktop Entry]
Name=File Browser (Root)
Comment=Browse the filesystem with the file manager
Exec=gksudo nautilus
Icon=file-manager
Terminal=false
Type=Application
Categories=Application;System;
I don't know where to find it in Ubuntu, but the name you are looking for is ¨File Browser (Root)¨.
In Linux Mint, go to the start menu -> Administration, where you'll find ¨File Browser (Root)¨.
The text you have copied contains a line that starts with Name =. This is the name you have given your shortcut, in our case it's ¨File Browser (Root)¨. You may name the shortcut anyway you like, e.g Nemo (root) or Nautilus (root).
Please open the root version of your file browser.
Look at the shortcuts under my Computer on the left panel. You'll find the Home directory and the Desktop shortcut of the root user and not you user.
Click on File System and go to the following location: home.
There you should find a folder with the name of your current account. Drag that folder under Bookmarks in the left panel. Then enter your user-folder and do the same with all folders you want to pin to the panel.
Oh, and by the way, you might want to pin the browser to the taskbar/launcher or some other locations:
(Linux Mint only:) start menu -> Administration -> File Browser (Root). Make a right click and you should have the option to add the browser to the panel (task bar), to the desktop and to your favorites (start menu, left bar).
If you are a more average user than I am, you are probably done. You now can install, remove and modify your programs, settings and OS via the Terminal and the GUI without having to enter your password every time you do. Furthermore, you can now do some modifications directly via the GUI without worrying about cryptic Terminal commands.
But if you need or want to do the following, you'll need to continuing on: Open Google Chrome, Firefox or any other browser via the taskbar or launcher and try to save a website in the following location: /root. Yes, you can't. Your browser is not running as root, therefore you don't have the necessary file permissions. If you are like me and use an IDE (a program you use for programming other programs) to develop programs that need to modify system files or other programs every time you want to test it, you still have a problem.
If you want to solve this the easy way, open those programs via the command line:
Code: Select all
gksu firefox
Code: Select all
gksu google-chrome
4. Opening programs as root
Like I mentioned above, you could use:
Code: Select all
gksu PROGRAM_NAME
There are a couple of programs where this won't work as the programmers have chosen to protect you from yourself by not allowing to open their programs as root. Usually, there is a workaround like for Google Chrome and PlayOnLinux.
The problems with this approach:
1. It's indirect. Instead of clicking on an icon, you have to open the terminal and type in the name of the program you want to open preceded by gksu/gksudo. At least you don't have to enter your password anymore.
2. You need to know that Thunderbird Mail is actually called thunderbird, for example.
There is an easier way, especially if you want to open a program multiple times as root or always. We have already done this with nemo/nautilus. Running Firefox as root might not be very useful to most but chances are you have already installed it which makes it a good candidate for testing.
Terminal command:
Code: Select all
sudo nano /usr/share/applications/Firefox-Root.desktop
Code: Select all
[Desktop Entry]
Name=Firefox (Root)
Comment=Browse the Internet with firefox
Exec=gksudo irefox
Icon=file-manager
Terminal=false
Type=Application
Categories=WebBrowser;Network
https://specifications.freedesktop.org/ ... c-1.1.html
will explain the above code.
I have used nano in my previous commands as it is pre-installed in both Linux Mint and Ubuntu but I usually prefer gedit. Unless I am mistaken, gedit is already installed in Ubuntu but not in Linux Mint.
I would advise you to install it via:
Code: Select all
sudo apt-get install gedit
This method is great if you only need to open a few programs regularly as root but not if you have many of those or they are often changing. In this case you'll need to change the permissions.
Changing permissions:
WARNING: This can easily break your system. As a matter of fact, it has broken quite a couple of my virtual machines. So unless you have a full backup or a virtual machine that can either break or is backed up, please do not proceed.
I will add the rest later