System administration

Devices and disk access

With Linux your disks and USB media are seen as devices. To access them you must first mount a device on a mount point (directory). On SliTaz you can graphically mount devices using mountbox or use the command line. To mount the first disk of a local hard disk on /mnt/disk:

 # mkdir -p /mnt/disk
 # mount /dev/hda1 /mnt/disk

To mount a cdrom or an USB media you should use mount points located in /media. Note that for a cdrom, you just have to specify the device path and for a flash key the mount point already exists:

 # mount /dev/cdrom
 # mount /dev/sda1 /media/flash

ntfs filesystem

If you need read/write access to Windows ntfs filesystems you must install a few additional packages from the mirror. The ntfs-3g driver provides stable access to ntfs partitions and ntfsprogs provides manipulation tools dependent on fuse. Note that you can format, move or resize ntfs partitions graphically with Gparted.

Users, groups and passwords

To manage users and groups on your SliTaz system you must use the command line, but file permissions can be changed graphically using the emelFM2 file manager. To add or remove users and groups you must be root. Root can also change all user passwords and a single user can only change his/her own password. To add or remove a user named linux:

 # adduser linux
 # deluser linux

To add or remove a group you must use addgroup or delgroup. To change the current user password or change the password of a specific user, you must use the command passwd:

 $ passwd
 # passwd username

Audio group

If you want a new user to be able to listen to music he must be in the audio group. To add an existing user to the audio group:

 # adduser -G audio user_name

Language and keyboard layout

SliTaz saves the configuration of the default locale in /etc/locale.conf which is read by /etc/profile on each login and the keyboard setting is stored in /etc/kmap.conf. These two files can be edited with your favorite editor or configured respectively with tazlocale and tazkmap. You can modify the settings you chose on the first boot by typing as root administrator:

 # tazlocale
 Or:
 # tazkmap

To check all available locales or your current configuration you can use the command locale as a single user or root (C for English):

 $ locale -a
 $ locale

Bash Shell

On SliTaz you have the ash and sh shell with a link to Ash, this shell is provided by Busybox. If you wish to use the Bash (Bourne Again SHell), first as root install bash, copy the .profile found in your home directory and rename it .bashrc, then edit the /etc/passwd file with your favorite text editor and change your shell to :/bin/bash

 # tazpkg get-install bash
 # cp /home/hacker/.profile home/hacker/.bashrc
 # Note root user: cp /home/hacker/.profile ~/.bashrc
 # nano /etc/passwd   # :/bin/bash

The next time you login bash will be your default shell, you can confirm this by typing env in the command line.

System Time

To know the current system time, you can simply type date. On SliTaz, the timezone configuration file is saved in /etc/TZ, you can edit with your favorite text editor or simply echo the changes. To view the available timezones, you can look in the /usr/share/zoneinfo directory. Here's an example using the timezone Europe/London:

 # echo "Europe/London" > /etc/TZ

Rdate

To syncronize the system clock with a network time server, you can as the root administrator use the rdate -s command:

 # rdate -s tick.greyware.com

To display the time on the remote server, use the rdate -p command.

 $ rdate -p tick.greyware.com

Hwclock

Hwclock allows you to syncronize the time of your hardware clock to the system clock or vice versa.

Syncronize the system clock to the hardware clock ( --utc = universal time, -l = local time):

 # hwclock -w --utc

Syncronize the hardware clock to the system clock:

 # hwclock -s --utc

Execute scheduled commands

The daemon 'crond' allows you to run commands automatically at a scheduled specific date or time. This is very useful for routine tasks such as system administration. The directory cron uses is /var/spool/cron/crontabs.

Each user of the system can have his/her own tasks, they are defined in the file: /var/spool/cron/crontabs/user. The crontab utility allows you amongst other things, to list the tasks specific to the user. The syntax of the files is as follows:

mm hh dd MMM DDD command > log

We will create a file with root priviledges and test the daemon 'crond' with a task performed every minute - writing the date to a file /tmp/crond.test. It should be noted that the utility has an option crontab for editing cron file using 'vi', this is not provided by SliTaz. In it's place you can use GNU nano (<Ctrl+X> to save & exit):

 # nano /var/spool/cron/crontabs/root
* * * * * date >> /tmp/crond.test

Launch crond with the option -b (background), configured via /etc/daemons.conf and using the startup script:

 # /etc/init.d/crond start

You can wait a few minutes and view the contents of the file: /tmp/crond.test... OK:

 # cat /tmp/crond.test

To stop or restart the daemon crond:

 # /etc/init.d/crond stop
 Or :
 # /etc/init.d/crond restart

Invoke the daemon crond on every boot

To launch the daemon 'crond' each time you boot the system, just add it to the variable START_DAEMONS in the configuration file /etc/rcS.conf, either before or after the web server or SSH server.

Add commands to be executed at boot

During the boot process, various scripts are executed to configure services, such as the start of the web server, networking etc. On SliTaz there is a script /etc/init.d/local.sh which allows you to add commands to be launched at system startup. You can also create new scripts in /etc/init.d, their links in /etc/rc.scripts for shell scripts and use /etc/rc.d for links to the startup script daemon in /etc/rcS.conf:

 # nano /etc/init.d/local.sh
Copyright © 2008 SliTaz - GNU General Public License;
Documentation is under GNU Free Documentation License and code is valid xHTML 1.0.