Squeezebox Setup

Linux 101

The instructions on this site focus on a low power, server style linux setup. The instructions can be a bit daunting, as the focus is command line only but you shouldn’t let that put you off. The info below is enough to have you logging in, moving round the file system and editing files – thats enough to do everything on this site. If you still dont feel confident enough then try out a linux live cd (linux mint is my favorite linux for the desktop), load up the terminal application and have a go. Alternatively download virtual box and install linux onto a virtual machine. Finally remember that if your data is backed up then the worst that can happen is you have to start over.

Logging in

As mentioned elsewhere the best way to access the linux box once it has lost its monitor and keyboard is with a combination of Putty and WinSCP. Putty lets you log in remotely, and WinSCP lets you transfer files to the box.

Security

Linux is out of the box a lot more security focused than windows (or at least traditional windows!). You must be logged on as a specific user, and what individual users can do is very restricted. There is a master admin user – root – setup when you install the OS. This user can do everything, up to and including totally breaking the system if you aren’t careful. Most of these pages are written with me logged in as root – for setup of a home pc my opinion is that this is fine (many would disagree), but for day to day stuff you should definately not log in as root. This also means the root password is very important – dont forget it, don’t make it the same as other passwords and dont give it to other people. Users are divided up into groups for security, and every file is permissioned at user, group and world level. So a file has 9 secuirty settings – read, write and execute for the file owner, the file group and global. There are commands covered below to change these permissions.

Logging in as root

If you open putty the first thing you see is a prompt asking for machine details. When you set the box up you should have given it a fixed IP – enter that and you will get a prompt. Enter root as the username and your password and you’re in.

Editing files

You can of course use winSCP to edit files on the pc, but it’s pretty easy from the command line too – there is a text editor called nano included

[root@tranquilpc ~]# nano /etc/fstab

will edit the fstab file in /etc. When nano is loaded its ctrl-x to quit, ctrl-o to write, ctrl-w to search, and ctrl-g for help. The editor is pretty easy to use, and hopefully a lot quicker than using WinSCP to remote login and modify files.

The command line

Linux has a fairly nice windows environment these days, but on a server with no monitor it’s not really required! These instructions deliberately do not install a windows environment, and everything is done through the command line. This is a lot less scary than it sounds – you dont really need to know that much to navigate round quite happilly. There are much, much better tutorials out there than this – but if you are after a quick reference for what the various instructions on this site to then this should help out. Basic commands are:

pwd - display the folder you are in (/root in the example below)

[root@tranquilpc ~]# pwd
/root

ls – display the files in the current folder. You can also specify a directory, and various flags to change the format of the output

[root@tranquilpc ~]# ls
anaconda-ks.cfg install.log install.log.syslog
[root@tranquilpc ~]# ls /root
anaconda-ks.cfg install.log install.log.syslog
[root@tranquilpc ~]# ls -l
total 36
-rw------- 1 root root 1144 Mar 13 14:28 anaconda-ks.cfg
-rw-r--r-- 1 root root 13793 Mar 13 14:28 install.log
-rw-r--r-- 1 root root 2886 Mar 13 14:28 install.log.syslog
[root@tranquilpc ~]#

Notice that ls -l is showing the file owner (root - the left column) and group (also root - the right column), and the permissions:

rw-r--r-- is read / write for the owner (root), read for the group (root) and read for everyone.

cd - change directory. cd .. moves you up one directory, cd /root would move you to root. cd by itself will move you to your home directory:

[

root@tranquilpc ~]# pwd
/root
[root@tranquilpc ~]# cd /etc
[root@tranquilpc etc]# pwd
/etc
[root@tranquilpc etc]# cd ..
[root@tranquilpc /]# pwd
/
[root@tranquilpc /]# cd
[root@tranquilpc ~]# pwd
/root
[root@tranquilpc ~]#

mkdir – creates a directory

[root@tranquilpc test]# mkdir test
[root@tranquilpc test]# ls -l
total 4
drwxr-xr-x 2 root root 4096 Mar 14 16:57 test

Notice the d at the front of the permissions section to mark it as a directory.

rmdir - remove a directory - the directory must be empty

[root@tranquilpc test]# rmdir test
[root@tranquilpc test]# ls -l
total 0

chgrp – change the group a file belongs to

[root@tranquilpc test]# ls -l
total 4
-rw-r–r– 1 root root 6 Mar 14 16:58 test.txt
[root@tranquilpc test]# chgrp apache test.txt
[root@tranquilpc test]# ls -l
total 4
-rw-r–r– 1 root apache 6 Mar 14 16:58 test.txt

chown – change the owner of a file

[root@tranquilpc test]# ls -l
total 4
-rw-r–r– 1 root apache 6 Mar 14 16:58 test.txt
[root@tranquilpc test]# chown apache test.txt
[root@tranquilpc test]# ls -l
total 4
-rw-r–r– 1 apache apache 6 Mar 14 16:58 test.txt

cp - copy a file:

[root@tranquilpc test]# ls
test.txt
[root@tranquilpc test]# cp test.txt test2.txt
[root@tranquilpc test]# ls
test2.txt test.txt

ln - link a file. This is like copying, in that the file is accessable from two places, but you only have one copy of the file, which a link pointing at it.

[root@tranquilpc test]# ls
test.txt
[root@tranquilpc test]# ln -s test.txt test2.txt
[root@tranquilpc test]# ls -l
total 4
lrwxrwxrwx 1 root root 8 Mar 14 17:10 test2.txt -> test.txt
-rw-r–r– 1 apache apache 6 Mar 14 16:58 test.txt

Notice the ls -l shows the link to the original file as part of the listing

rm - delete a file:

[root@tranquilpc test]# ls
test2.txt test.txt
[root@tranquilpc test]# rm test2.txt
rm: remove regular file `test2.txt’? y
[root@tranquilpc test]# ls
test.txt

ps - list all the processes running on a machine – the default is just for the logged in user - ps -ef will give all processes

[root@tranquilpc test]# ps
PID TTY TIME CMD
2761 pts/0 00:00:00 bash
4767 pts/0 00:00:00 ps

grep - search for a string in a file or files – grep hello *.txt searches all txt files for the string hello. the -H flag can be used to print the filename too

[root@tranquilpc test]# grep -H hello *.txt
test.txt:hello

chmod – change the permissions on a file

cat – displays the contents of a text file

[root@tranquilpc test]# cat test.txt
hello

| – sends the output of one command into another, so ps -ef | grep squeeze will show all running proceses with squeeze in the name

[root@tranquilpc test]# ps -ef | grep squeeze
101 2450 1 0 13:08 ? 00:00:48 /usr/bin/perl -w /usr/libexec/squeezeboxserver –daemon –prefsdir=/var/lib/squeezeboxserver/prefs –logdir=/var/log/squeezeboxserver –cachedir=/var/lib/squeezeboxserver/cache –charset=utf8
root 4823 2761 0 17:06 pts/0 00:00:00 grep squeeze

< - reads a file and provides it as input

> - sends the output to a file (>> appends the output to a file)

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: