humpty promotes - Linux - Lubuntu

Lubuntu linux Tips
 
Root Terminal



One of the most annoying things about linux is not being the 'root' user all of the time meaning you have to find ways around it like having to enter passwords (fixed here ), having to use chmod, chown..etc so that you can have the privilage to do simple things when you shouldn't have to at all.

One such work around is to open a root-shell or root-terminal.

A sure fire way to get root privalege is to open a normal terminal (shortcut in the lubuntu menus). This opens lxterminal. To become root, enter;

sudo bash

It would be more convenient to create a tailor made shortcut that automatically opens as root.
To create a shortcut, create an STerminal.desktop file in the directory;   ~/.local/share/applications

~/.local/share/applications/STerminal.desktop

[Desktop Entry]
Encoding=UTF-8
Name=STerminal
Comment=root cmdline

Exec=sudo lxterminal

Icon=gksu-root-terminal
Type=Application
Categories=Utility
NoDisplay=false

The shortcut should turn up under 'Accessories' in the lxpanel menu. To create a launch button;
right-click lxpanel > panel settings > panel applets > application launch bar > edit >
and find the shortcut under 'accessories'.

Problems with PATH

Sometimes sudo lxterminal opens as root with problems finding the PATH environment variable causing some programs not being found. This problem can be compounded if the kernel was compiled with a 'secure PATH', i.e editing root's .profile or .bashrc has no effect in changing it's PATH.

There are various ways to 'go around' this;

1.) edit ~/.bashrc to add alias sudo='sudo env PATH=$PATH'
This passes the current PATH to any sudo command.
or
2.) editing root's .profile or .bashrc and forcing a login-shell
(add your paths to PATH=)
create the shortcut  as before : sudo lxterminal -l
or
3.) forcing lxterminal to execute a bash shell
create the shortcut  as before : sudo lxterminal -e bash
or
4.) a combination of 1, 2 and 3
sudo lxterminal -l -e bash

Method 4 works well for me ;
i.e in STerminal.desktop, use Exec=sudo lxterminal -l -e bash


/End.

Advertisement

[ More Lubuntu Tips,  Home ]


Leading Cloud Surveillance service

Leading Enterprise Cloud IT Service Since 2003

Powered by FirstCloudIT.com, a division of DriveHQ, the leading Cloud IT and Cloud Surveillance Service provider since 2003.