This is an old revision of the document!
Table of Contents
Systemverwaltung
Geräte und Datenträger
Linux betrachtet Platten und USB-Speichermedien als Geräte. Um auf Speichermedien zugreifen zu können, müssen sie als Gerät in einem Einhängepunkt (Verzeichnis) eingehängt werden. Unter SliTaz kann dies mit dem grafischen Programm mountbox oder über ein Kommando geschehen. Zum Beispiel kann die erste Partition der ersten internen Platte in dem Verzeichnis /mnt/disk eingehängt werden mit:
# mkdir -p /mnt/disk # mount /dev/hda1 /mnt/disk
Zum Einhängen von optischen Datenträgern oder USB-Speichermedien sollten Einhängepunkte im Verzeichnis /media verwendet werden. Bei optischen Datenträgern braucht nur der Gerätename angegeben zu werden. Für USB-Speichermedien ist ein Einhängepunkt vordefiniert:
# mount /dev/cdrom # mount /dev/sda1 /media/flash
NTFS-Dateisystem
Wenn auf ein Windows NTFS-Dateisystem zugegriffen werden soll, müssen einige zusätzliche Pakete installiert werden. Der Treiber ntfs-3g bietet zuverlässigen Zugriff auf Partitionen mit NTFS-Dateisystemen und ntfsprogs stellt Programme zur Manipulation zur Verfügung, die FUSE verwenden. Mit Gparted können Partitionen mit NTFS-Dateisystemen grafisch verschoben und in der Größe verändert werden.
NFS
NFS (Network File System) ist die UNIX- und Linux-eigene Methode, Dateisysteme über Netzwerke anderen zur Verfügung zu stellen. Insofern ähnelt die Funktion der von samba. Die meistbenutzte Version ist immer noch NFS Version 3, die UDP oder TCP als Netzwerkprotokoll verwenden kann. Die ältere Version 2 konnte nur UDP verwenden. In einem LAN ist UDP immer noch das schnellste Protokoll; TCP sollte vorgezogen werden, wenn die Rechner über ein WAN kommunizieren. Die Version 3 wurde von Version 4 abgelöst, die gegenüber Version 3 einige bemerkenswerte Verbesserungen (bei der Sicherheit) aufweist, deren Konfigurierung infolgedessen aber wesentlich komplexer ist.
Ein NFS-Server stellt einen Teil seines Dateisystems für andere zur Verfügung; d.h. es kann über ein Netzwerk darauf zugegriffen werden. In der Server-Konfiguration können IP-Adressen oder Namen von Rechnern angegeben werden, denen Zugriffe (nur lesend oder auch schreibend) gestattet oder verwehrt werden sollen. Ein NFS-Klient hängt ein solches Dateisystem einfach ein wie ein lokales Gerät.
Die NFS-Software in Slitaz ermöglicht beide Funktionen: Server oder Klient. Zum Starten (und Beenden) der NFS-Prozesse gibt es eine Kommandoprozedur im Verzeichnis /etc/init.d.
/etc/init.d/nfsd start|stop
NFS Software-Installation
NFS benötigt die Pakete linux-nfsd und nfs-utils.
Mit den Kommandos
# tazpkg -gi linux-nfsd # tazpkg -gi nfs-utils
können diese installiert werden.
/etc/exports
Es folgt ein Beispiel für die Datei /etc/exports:
# /etc/exports: the access control list for filesystems which may be exported # to NFS clients. See exports(5). # # Beispiel für NFSv2 und NFSv3: # /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check) # # Beispiel für NFSv4: # /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check) # /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check) # /usb1 192.168.1.0/24(rw,sync,no_subtree_check)
Es wird nur ein Dateisystem zur Verfügung gestellt: usb1. Klienten müssen sich im Netzwerk 192.168.1.0/24 befinden und diese haben lesenden und schreibenden Zugriff.
Der Klient muss nur nfsd starten und das Dateisystem einhängen:
# /etc/init.d/nfsd start # mount server:/usb1 /mnt/usbdrive1
Beachten Sie das spezielle Format zur Angabe des Dateisystems: Rechnername:Einhängepunkt. Der angegebene Einhängepunkt (das Verzeichnis) muss natürlich im Klienten vorhanden sein.
Benutzerkennungen, Benutzergruppen und Kennwörter
To manage users and groups on your SliTaz system you must use the command line, but file permissions can be changed graphically using the PCmanFM 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
Benutzerkennungen und -gruppen bearbeiten
Linux groups are a mechanism to manage a collection of computer system users. All Linux users have a user ID and a group ID and a unique numerical identification number called a userid (UID) and a groupid (GID) respectively. Groups can be assigned to logically tie users together for a common security, privilege and access purpose. It is the foundation of Linux security and access. Access to files and devices may be granted based on a user ID or a group ID. This mechanism is the same for all of linux but the way it is configured varies per distribution. Sometimes additional or different commands are used, like for example usermod, chgrp, useradd or groupadd. Below is an overview of how to handle users, groups and group membership on Slitaz.
The Slitaz way is using only four commands. Simple & Elegant.
# adduser <username> <= adds a user # deluser <username> <= deletes a user # addgroup <groupname> <= adds a group # delgroup <groupname> <= deletes a group # addgroup <username> <groupname> <= adds a user to a group # adduser -G <groupname> <username> <= adds the user to an additional group # delgroup <username> <groupname> <= deletes a user from a group
Any user can be member of any group and the combination of user & group permissions allows for granular access to system resources.
Benutzerkennwort
To change the current user's password or change the password of a specific user, you must use the passwd command:
$ passwd # passwd username
Die Gruppe audio
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
Sprache und Tastaturbelegung
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 tazkeymap. You can modify the settings you chose on the first boot by typing as root administrator:
# tazlocale Or: # tazkeymap
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
benutzerspezifischer Kommandointerpreter
SliTaz uses the ash shell linked to sh provided by busybox. Ash is light, fast and standards compliant. To change the default shell for a user you can edit the /etc/passwd file using the corresponding line. After you login, /etc/profile is read first and then the user file ~/profile. You can edit these files with a text editor to configure the language, any aliases, etc.
Beispiel für ~/.profile
# ~/.profile: executed by Bourne-compatible login shells. # # Aliases. alias ls='ls -F' alias df='df -h' # Env variables. export EDITOR=nano
Kommandointerpreter bash
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 on the command line.
Dateibearbeiter
Busybox supplies a clone of vi for normal text editing, but it does have its limitations. You can install the full vim editor with the command:
# tazpkg get-install vim
Or alternatively if you prefer emacs, SliTaz offers a tiny version:
# tazpkg get-install emacs
Das Kommando sudo
The sudo command can be applied on SliTaz:
# tazpkg get-install sudo
Note that the configuration file /etc/sudoers, should always be edited by the visudo command which locks the file and checks for errors.
Systemzeit
To check the current system time, you can simply type:
$ date
Zeitzone
On SliTaz, the timezone configuration file is saved in /etc/TZ, you can edit this 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
Realzeituhr
To synchronize the system clock with a network time server, you can (as root) 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
NTP
NTP is a protocol to synchronize the time on many different systems via a network. NTP is a client-server application which uses UDP port 123. This section describes how to configure your system as an ntp client deriving its time from the Internet. There are many servers available on the Internet which provide an ntp service.
Although Slitaz is a small distribution, it provides several ntp implementations. Most notably:
1: busybox ntpd (included in the base installation). Using busybox ntpd from the command line:
# busybox ntpd -p nl.pool.ntp.org OR # ntpd -p nl.pool.ntp.org
2: ntp.tazpkg (install from packages repository). To install ntp.tazpkg:
# tazpkg -gi ntp
This package includes a decent set of ntp related binaries + the config file /etc/init.d/ntp
# tazpkg list-files ntp Installed files with: ntp ========================= /etc/init.d/ntp /etc/ntp.conf /usr/bin/ntpd /usr/bin/ntpdate /usr/bin/ntpdc /usr/bin/ntp-keygen /usr/bin/ntpq /usr/bin/ntptime /usr/bin/ntptrace /usr/bin/ntp-wait /usr/bin/sntp /usr/bin/tickadj
Be aware that Slitaz has several ntp daemons available. We have the Busybox app but also the ntp package. Both provide virtually the same functionality. If you have limited resources, the busybox version can provide all you need. If you want all the diagnostic stuff as well, you should rather go for installing ntp.tazpkg.
NTP-Hintergrundprozess bei der Systemeinleitung starten
Probably the easiest way to start busybox ntpd at boot is to add an entry like above to /etc/init.d/local.sh. The explanation below focuses on ntp.tazpkg. It is unclear which one was intended by the developers to be started by the Server Manager. This can be somewhat confusing. The verified way to configure the ntp daemon is to use the command line as detailed below.
To start /usr/bin/ntpd (ntp.tazpkg) at boot:
1: Make sure to install the package as shown above .
2: Edit /etc/daemons.conf as follows:
Add one line at the end: NTP_OPTIONS="-p xx.pool.ntp.org" (where xx = country.)
3: Edit /etc/rcS.conf as follows:
On the line with daemons to start, add ntp to the list: RUN_DAEMONS="inetd dbus hald slim firewall httpd ntp "
Use the following to check if the daemon is running:
$ ps -ef | grep ntpd 1934 root 0:00 /usr/bin/ntpd -p nl.pool.ntp.org 2193 root 0:00 grep ntpd
In this example, the first line shows the process we want to see.
Prüfen, ob ntpd richtig arbeitet
You may use ntpq to verify your connection to ntp servers
# ntpq -p nl.pool.ntp.org remote refid st t when poll reach delay offset jitter ============================================================================== *ntp0.nl.uu.net .PPS. 1 u 632 1024 377 2.700 0.233 0.096 +ntp1.nl.uu.net .PPS. 1 u 504 1024 377 1.742 0.356 41.789 -chime1.surfnet. 194.171.167.130 2 u 298 1024 377 0.677 0.102 0.134 +chime4.surfnet. .PPS. 1 u 422 1024 367 9.652 -2.669 0.366 tt165.ripe.net .STEP. 16 u - 1024 0 0.000 0.000 0.000
The * at the start of a line indicates the server you are currently synchronized to.
The column “st” shows the stratum or quality of the time source. 1 is best, 16 means unavailable. Important to check are the columns “reach” and those behind. Reach should be 377, everything else means polls were missed. Your daemon should be running for a while to get reliable output.
Hwclock
Hwclock allows you to synchronize the time of your hardware clock to the system clock or vice versa.
Synchronize the system clock to the hardware clock ( --utc = universal time, -l = local time ):
# hwclock -w --utc
Synchronize the hardware clock to the system clock:
# hwclock -s --utc
hwclock -u, --utc | -l, --localtime
Indicates that the Hardware Clock is kept in Coordinated Universal Time or local time, respectively. It is your choice whether to keep your clock in UTC or local time, but nothing in the clock tells which you've chosen. So this option is how you give that information to hwclock. If you specify the wrong one of these options (or specify neither and take a wrong default), both setting and querying of the Hardware Clock will be messed up.
Synchronizing the hwclock with ntp
There are several ways to set the hardware clock to ntp time:
# busybox ntpd -dnqp nl.pool.ntp.org && hwclock -w -u
OR:
# ntpdate -u nl.pool.ntp.org && hwclock -w -u
Alternative three: (quite old, may not work on all servers)
# rdate -s nl.pool.ntp.org && hwclock -w -u
Note that in all examples we used the -u option to set hwclock to UTC time.
Further reading: http://linux.die.net/man/8/hwclock
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 on the system can have his/her own tasks, they are defined in the file: /var/spool/cron/crontabs/user. You must be root to edit this file. The crontab utility allows you (amongst other things), to list the tasks specific to the user.
# crontab -l <== To list the crontab for user root. OR: # crontab -l -u tux <== To list the crontab for another user.
The syntax of the crontab files is as follows:
mm hh dd MMM DDD command > log
We will create a file with root privileges 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 its place you can use GNU nano (<Ctrl+X> to save & exit):
# nano /var/spool/cron/crontabs/root
Add the line:
* * * * * 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