Posts Tagged ‘ubuntu’

Change Ubuntu Default ‘ls’ Command Alias…….

Tuesday, April 27th, 2010

Change Default Ubuntu Aliases

By default Ubuntu (plus several others) change the ‘ls’ command to be an alias that colour codes the output. While I’m sure this is great for many people, I don’t like it :o(

I like back background, lime green text, directories indicated with a ‘/’ character at the end, and hidden files to be shown.

To change the default, you need to make the same change in a couple of places…….

Firstly, in your home directory. Edit the hidden file ‘.bashrc’. Find the line that reads alias ls=’ls –color=auto’ and comment it out with a ‘#‘ at the start.

Then add a new line (above or below, does not matter) with the following

ls=’ls -aF’ (in this case, ‘a’ shows all files including hidden ones, ‘F’ indicated a directory by adding a trailing forwardslash ‘/’ after the directory name

This will change your login only. If you also want to change the root ls alias you will need to follow the same steps for the file /root/.bashrc, but you will need to either use sudo with your edit command, or su to root and then edit.

The last place you may wish to edit is the skeleton template file used for all new users. This is located at /etc/skel/.bashrc. Again, eidt the file with the changes above, and all newly added users will recieve a copy of the file and have their ls command alias set to your formatting (if you so wish).

Enable The ‘root’ User Account In Ubuntu…….

Friday, March 12th, 2010

I like consistency. It makes things easier, and me faster and more accurate/efficient/amazing to watch etc. etc.

As Ubuntu is the 4th Linux distro I have ever had to work with (first being OpenBSD, the FreeBSD, then Red Hat) I was getting a little annoyed that after an install ‘su’ did not work as I was previously used to.

Ubuntu chose instead to lock the root account out and force you into using the ‘sudo’ command. This means that to do anything as ‘root’ you use

sudo <command to run>

The system will then prompt you for *your* password and, if you have sufficient permissions in the sudoers file, will execute the command you provided with root level permissions.

There are of course some benefits, mainly centered around security. But there are also some drawbacks such as having to maintain the sudoers file, and command output redirection. But given that OpenBSD is considered one of the most secure Unix operating systems around and they don’t feel the need to do it this way, I like to change this behaviour immediately after the first post install reboot.

To enable the root account, logon to the system with your account and run

sudo passwd root

The system will prompt you for *your* password. It will then prompt you to enter a new password for the root account, and then to confirm it a second time. Once this is done you can just switch to the root use using the plain old ‘su’ command.

Oh, and if you’re worried about being able to log directly onto SSH as the root account, simply edit

/etc/ssh/sshd_config

and change the line

PermitRootLogin yes

to

PermitRootLogin no

This will ensure that you have to login as a normal user and su to root from remote connections.

If you wish to revert back to the default Ubuntu behaviour, simply run (under your own logon)

sudo passwd -l root