Enabling desktop shortcuts in root account

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
ka6555

Enabling desktop shortcuts in root account

Post by ka6555 »

Hi guys,
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
And modify them as follows:

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
Now you're probably asking yourself how to save and exit:
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
Choose a password for the root user and you are done.
Now you can type:

Code: Select all

su
Enter the password you were asked to enter after you typed

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
(if you haven't given the root account a password)
OR

Code: Select all

gksu nemo
OR

Code: Select all

sudo nemo
(I'm not sure if this works before you have disabled the graphical password prompts, though it does work with my modified version of Linux Mint 18 which has already this modifications)

If your version of Linux Mint does not include gksu for some reason, don't worry:

Code: Select all

sudo apt-get install gksu
should fix the problem.

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
Ubuntu users should keep in mind that their file manager is not called nemo but nautilus, therefore they'll have to replace every nemo with nautilus in the following manner:

Code: Select all

gksu nautilus
(if you haven't given the root account a password)
OR

Code: Select all

gksu nautilus
If everything works as expected, you'll see a password prompt if you have used gksu/gksudo. After you have entered your password, hopefully for the last time apart from logins, you'll see your file manager called nemo (Linux Mint) or nautilus (Ubuntu).

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
You can now install programs via your distribution's store app without any password prompts. The same goes for other administrative applications.

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
A text editor will popup within your terminal.
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;
Ubuntu:

Code: Select all

sudo nano /usr/share/applications/Nautilus-root.desktop
A text editor will popup within your terminal.
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;
Saving works as with getting rid of the sudo password. ctrl + x, then enter y for save changes.

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
. Just replace firefox by the name of the program you want to open as root. Keep in mind, some programs like Google Chrome (

Code: Select all

gksu google-chrome
) will not work as you need to modify them to run as root. The reason is that those developers want to protect you from yourself. It's easy to workaround this but I am not gonna cover this.

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
Text to copy and paste into the terminal:

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://wiki.archlinux.org/index.php/Desktop_entries and
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
The reason is that gedit does perform code highlighting while nano does not. For instance gedit marks Network (under Categories) red. This means that you have entered the name of a valid category. So Firefox will be displayed under Internet instead of others.

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
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 5 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Pjotr
Level 23
Level 23
Posts: 19886
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Enabling desktop shortcuts in root account

Post by Pjotr »

ka6555 wrote:Hi guys,
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.
This is *not*, repeat *not*, the way to "learn to find your way around with Linux". This is the way to get a messed up trainwreck of a system. :shock:
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Habitual

Re: Enabling desktop shortcuts in root account

Post by Habitual »

ka6555 wrote:I have activated the root account to avoid permanently entering my password.
Good for you. You have just weakened a perfectly good OS.

Never, Ever, EVER use the system as root.
ka6555

Re: Enabling desktop shortcuts in root account

Post by ka6555 »

I don't want a high security OS, but an OS with which I can work in a productive way. From experience, I have had by far more trouble and work with some security measures than with the things they protected me from. Even with Windows and no UAC, I only got a virus once. One just has to be careful what to install and what not, and not to press some unkown link in an email. It is in most cases as simple as that. And if something happens, in Windows I know how to repair things and in the worst case, there is still the option of a clean install and a backup.
And in Linux? Because of its low market share, there aren't many people bothering to write viruses. Besides, all my important data are saved in a shared folder on Windows or on an external drive. Furthermore, I have a copy of the virtual machine. So what do I care if it gets broken? I just make a copy of the backup and delete the corrupted Os and I can continuemy work.

I don't have some secret documents, bank account data, humillating pictures, etc on the virtual machine, so there is nothing to steal.

The point is, while I am learning, I often need root acess. If I use the machine for testing, I need root access. I don't use the machine for standard stuff like emails and office work. I need Microsoft Office for that, and no LibreOffice is not compatible enough to correctly open a standart PowerPoint presentation of mine. So I basically ALWAYS use root. So why not using root in the first place and saving myself an annoying step?

I am sorry if this sounds unpolite, I just have the experience that using one's brain is nearly as good as an UAC or the Linux equivalent, however that is officcially called. You don't go out on the street in a protection suite against nuclear radiation, just in case there will be an power plant accident.

Ah, I forgot, the password won't save me from screwing up the system myself. In Windows it's the same. Because of the many UAC prompts, people just click 'yes' without thinking. That's the problem if something is used inflationary.
User avatar
Pjotr
Level 23
Level 23
Posts: 19886
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Enabling desktop shortcuts in root account

Post by Pjotr »

Well, do as you please.... Personally, I'm not going to help you with a fundamentally crazy approach. No offense meant. :mrgreen:
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Habitual

Re: Enabling desktop shortcuts in root account

Post by Habitual »

Pjotr wrote:Well, do as you please.... Personally, I'm not going to help you with a fundamentally crazy approach. No offense meant. :mrgreen:
I will not help in such a manner either.
There is no argument that can rationalize your approach to 'convenience' or 'Security'.
Your point is you don't care about Security, and in the same breath rattle off all the known protection methods for recent Windows OSs.
I smell some kind of bait.

Like to install? Have some free time?
It's a great way to verify the direness of "Never use the system as root".
Enough of the scolding. Carry On!
User avatar
Pjotr
Level 23
Level 23
Posts: 19886
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Enabling desktop shortcuts in root account

Post by Pjotr »

One more tip: take the advice of Linux veterans when you're a beginner with Linux. No matter how much of a big shot you are with Windows. Don't argue; it's uninformed and therefore pointless.

Linux is a different cup of tea; it pays to "go with the flow" when you begin with it. Later on, when you are an experienced Linux user yourself, you can deviate all you like, because then it's about *informed* deviations and not sheer lunacy stemming from ignorance. Again: no offense meant.

I was a Windows guru myself when I started with Linux, and I had to swallow much of my pride as well, when entering this hitherto uncharted country called Linux.... :mrgreen:
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: Enabling desktop shortcuts in root account

Post by Cosmo. »

ka6555 wrote:The point is, while I am learning, I often need root acess.
Then you do something obviously wrong. You seem not learning Linux, but ka6555-OS.
ka6555 wrote:I don't use the machine for standard stuff like emails and office work. I need Microsoft Office for that .... So I basically ALWAYS use root.
A strange logic: "I don't use the machine for ... office work, for that I need MS Office." This shall obviously be an argumentation, but it misses any piece of logic. Nevertheless, i you need root for working with MSO, you do it very very wrong. Not even for installing MSO you need root.
ka6555 wrote:UAC or the Linux equivalent
Your learning practice missed obviously 2 things in this regard:
At first, there is no Linux-equivalent for UAC.
Second: UAC is no security feature, it was never made for that. That is not my invention about it, but said more than once by the Microsoft technical fellow Mark Russinovich. Original:
Mark Russinovich wrote:It’s important to be aware that UAC elevations are conveniences and not security boundaries.
source
Mark Russinovich wrote:As we've stated since before the launch of Windows Vista, the primary purpose of elevation is not security, though, it's convenience
source. And many sources more.

If you really want to learn Linux, do it right. If you want to do something else, don't name it "Learning Linux". I believe, that you handle Linux as a somehow different looking Windows.
ka6555

Re: Enabling desktop shortcuts in root account

Post by ka6555 »

I will simply try out if using the root account without desktop icons or a hacked administrator account that won't prompt me for my password works better. Google Chrome could also be persuaded to run using the root account, so everything is fine.

I can clearly see that high security is useful for online banking, enterprises and servers, but for a home-workstation with backups, I prefer the compromise between security and convenience. By the way, I got in 15 years only one single virus and two adwares. So using caution combined with antivirus programs is more than good enough for me.

By the way, I am not a fan of ideologies. I use Linux because it is better than Windows for certain tasks, it is as simple as that. And Windows is better suited for other tasks. I don't care which OS I use, how long it runs the software I need and does its job.

If I want to change something, my own password won't stop me from that. So it won't prevent me from doing any mistakes. And viruses? Most programs I install are either from the repository/store, from sources I trust to be virus/trojan-free like google (don't care about the data mining or NSA aspect) or written by myself.

I prefer to learn new OSes according to the following motto:
"Of course I make mistakes. I'm human. If I didn't make mistakes, I'd never learn. You can only go forward by making mistakes." - Alexander McQueen
Only by embracing risk, I am going to learn how things work and not by opening a browser or a word processor.

No offense meant :) But I don't want to have an OS behaving like an always worried modern mother.

As there will be no agreement and people don't want to see a less secure version of Linux, I think this topic can be treated as closed.

It reminds me. I had written a kind of virus myself out of curiosity (C++) and while I was bored because of the bad weather.
Without UAC, one click was enough to completely eliminate Windows 7 (some virtual machine). Not even a free data recovery tool could restore the lost data. I destroyed the copy of the virus afterward to prevent any accidental triggers (nothing is more stupid than to accidently kill your own primary OS by your own virus :) ). And mind you, it was my first malicious program (and my last).
But face it, even with UAC on, from 50 people I know, maybe one or two would not have opted for the 'yes' option without a second thought. And I doubt that there is much of a difference with the average, non-geek users who have adopted Linux distros like Ubuntu in the last couple of years.
(I tested it on my own virtual machine, a copy of one I used. So no harm has been done. But it was quite interesting to see how easy it is to kill Windows. )
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: Enabling desktop shortcuts in root account

Post by Cosmo. »

ka6555 wrote:I got in 15 years only one single virus and two adwares.
You got too much. I have not seen 1 in more than 30 years.
ka6555 wrote:... people don't want to see a less secure version of Linux
Aha, now we got the point. Not "learning" or "testing self written programs" is the goal, but a new OS with less security is your request, the already named ka6555-OS.

Persuading Chrome to use the root account says it all. And doing this has nothing to do with learning or testing. But it has much to do with people, who do not hesitate to present their machine as part of a bot net, a spam catapult, which indeed concerns others. Asking for assistance for such behaviour is something, which dos not happen so often. :twisted:
User avatar
Pjotr
Level 23
Level 23
Posts: 19886
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Enabling desktop shortcuts in root account

Post by Pjotr »

ka6555 wrote: As there will be no agreement and people don't want to see a less secure version of Linux, I think this topic can be treated as closed.
Indeed we don't. Neither should you. Running a web browser as root... It's beyond dumb. It's an entire new elevated dumbness category of its own. :shock:

But this is becoming a waste of time. So goodbye and may you live happily ever after.
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Habitual

Re: Enabling desktop shortcuts in root account

Post by Habitual »

Pjotr wrote:
ka6555 wrote:It's beyond dumb. It's an entire new elevated dumbness category of its own. :shock:
It's the equivalent of writing your PIN on your Band Card, because it's 'too inconvenient' to have to remember it.

A statistic somewhere.
ka6555

Re: Enabling desktop shortcuts in root account

Post by ka6555 »

Terminal: sudo visudo

change to:
# 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:ALL) NOPASSWD: ALL

This should make the trick and nothing will breaks during updates. I also have more than one 'root' account so everything should be perfect. It seems it is a rather popular trick by the way, as there are a lot of sites showing it. So I am not the only one getting annoyed from an overprotective OS.
User avatar
Pjotr
Level 23
Level 23
Posts: 19886
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Enabling desktop shortcuts in root account

Post by Pjotr »

Image
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: Enabling desktop shortcuts in root account

Post by Cosmo. »

"I am not the only one getting annoyed" by somebody, who does not leave a single chance to proof, that he will never learn anything. It is to be feared, that there will come more and even greater stupidity. :twisted:
kukamuumuka

Re: Enabling desktop shortcuts in root account

Post by kukamuumuka »

Pjotr wrote:Image
That tells everything about using the root account .. :lol:

The best way to enable root account is to uninstall VMware Workstation from Windows and use Windows itself .. :wink:
Locked

Return to “Cinnamon”