Some basic Linux / setup tips

There are a number of rather trivial setup steps that can be performed to make ones life substantially easier when using Linux. These it seems tend to be omitted from training courses. The advice will be SUSE focused, but presumably somewhat transferable.

sudo - don't use your root account

Using your root account habitually is a bad mistake; although this may not be fully realised for several weeks. Instead, train yourself to use 'sudo' sparingly. To avoid making that painful wrt. authentication, it's important to do some configuration.

su - # become root vi /etc/sudoers

# Uncomment to allow people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL
                                                                                                                                          
# Same thing without a password
# %wheel  ALL=(ALL)       NOPASSWD: ALL
Remove the comment (bold) from the 2nd section: without a password. This allows the 'wheel' group to run commands as root with 'sudo' without authentication.

Then we need to ensure we are in the 'wheel' group:

        vi /etc/group
kmem:x:9:
wheel:x:10:insert your account name here
mail:x:12:
Having done this quit your root shell; and try: eg. sudo rug in openssh-askpass - it should execute this one command as root without requiring authentication.

ssh - type your pass-phrase only once

ssh is a very powerful tool, but the default configuration leaves a lot to be desired wrt. repeated pass-phrase authentication. To improve this situation two things are needed:

Install the pass-phrase prompt program useful when you log-in: sudo rug in openssh-askpass.

Then to ensure this is used when you log-in, add a section like this:

SSH_ENV=$HOME/.ssh/environment

function start_agent {
	echo "Initialising new SSH agent..."
	/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
	echo succeeded
	chmod 600 ${SSH_ENV}
	. ${SSH_ENV} > /dev/null
	/usr/bin/ssh-add;
}

# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
	. ${SSH_ENV} > /dev/null
	ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
		start_agent;
	}
else
	start_agent;
fi
to your ~/.bashrc file.

Now log out & as you re-login, you should be prompted for your pass-phrase. [ This assumes of course, that you have setup ssh correctly & have a pass-phrase protected key etc. ].


Questions ?, better tips ? contact me.