Adding and configuring a user on the NSLU2

So to add a user, I first using the Linksys/Unslung web admin interface to create a user. 

I wanted the users main command shell to be bash, as I find this more friendly to use, so once the user was added, I then edited the /etc/passwd file.

The last token on the line for the user contains the shell to be used.  I changed this to: /opt/bin/bash (Bash needs to be installed via ipkg before you do this)

If you don’t understand the passwd file format, take a look at http://www.cyberciti.biz/faq/understanding-etcpasswd-file-format/ which explains if pretty well.

 If you want the user to be able to access the slug via SSH, then you’ll need to follow the guide in my previous post to do this.  Once you’ve done this you should be able to log on and use the user.

 

Now the user has been added, you’ll want to change a few things and setup a few defaults.  As the user, in the home directory, create a .profile file (e.g. touch .profile).  Once this is created you can edit this.  My default .profile for my user looks like the following:

 

alias vi="vim" 
alias ls="ls --color=auto"
PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
EDITOR=vim  
export TERM=xterm-pcolor

 

You’ll notice I have vim installed (available via ipkg) and set the default editor to that rather than vi.  Vim is a bit smarter and colour codes the files you are looking at, making it much easier to edit them, plus it also fills the terminal window unlike the vi implementation that ships with the NSLU.

You can also see that I’ve aliased the ls command to issue the color parameter, to colour code directory listings. 

Finally, the PS1 line changes the prompt to show the current path where you are and uses some colour to help separate things out.  The combination of all this means my putty screen looks something like the following:

 

terminal

 

The bits I’ve blurred showed my username and server name. 

 

Vi (of S88cups) looks like:

 

 

After all this, I was nearly satisfied, though one thing still annoyed me.  Home and End didn’t work on the command line.  To make these work, I created a .bashrc file in my home directory.  In here I added one line:

 

export TERM=linux

 

This seems to  make the home and end key work, and still keeps the colour terminal as defined in the .profile file.

Leave a Reply

Your email address will not be published. Required fields are marked *