slitaz-doc-wiki-data view pages/en/handbook/systemutils.txt @ rev 7

Add pages/en folder.
author Christopher Rogers <slaxemulator@gmail.com>
date Sat Feb 26 12:17:18 2011 +0000 (2011-02-26)
parents
children 7f77649ceb97
line source
1 ====== System Administration ======
3 ===== Devices and disk access =====
5 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 by using mountbox or the command line. To mount the first disk of a local hard disk on ///mnt/disk//:
7 <code>
8 # mkdir -p /mnt/disk
9 # mount /dev/hda1 /mnt/disk
10 </code>
12 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. For a flash key, the mount point already exists:
14 <code>
15 # mount /dev/cdrom
16 # mount /dev/sda1 /media/flash
17 </code>
19 === ntfs filesystem ===
21 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.
23 ===== Users, groups and passwords =====
25 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:
27 <code>
28 # adduser linux
29 # deluser linux
30 </code>
32 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 passwd command:
34 <code> $ passwd
35 # passwd username </code>
37 === Audio group ===
39 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:
41 <code> # adduser -G audio user_name </code>
43 ===== Language and keyboard layout =====
45 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:
47 <code> # tazlocale
48 Or:
49 # tazkeymap </code>
51 To check all available locales or your current configuration, you can use the command locale as a single user or root (C for English):
53 <code>
54 $ locale -a
55 $ locale
56 </code>
58 ===== Bash Shell =====
60 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//
62 <code>
63 # tazpkg get-install bash
64 # cp /home/hacker/.profile home/hacker/.bashrc
65 Note root user: cp /home/hacker/.profile ~/.bashrc
66 # nano /etc/passwd ~ :/bin/bash
67 </code>
69 The next time you login bash will be your default shell, you can confirm this by typing env on the command line.
71 ===== Editors =====
73 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:
75 <code> # tazpkg get-install vim </code>
77 Or alternatively if you prefer emacs, SliTaz offers a tiny version:
79 <code> # tazpkg get-install emacs </code>
81 ===== Sudo =====
83 The sudo command can be applied on SliTaz:
85 <code> # tazpkg get-install sudo </code>
87 Note that the configuration file ///etc/sudoers//, should always be edited by the //visudo// command which locks the file and checks for errors.
89 ===== System Time =====
91 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:
93 <code> # echo "Europe/London" > /etc/TZ </code>
95 === Rdate ===
97 To syncronize the system clock with a network time server, you can (as root) use the //rdate -s// command:
99 <code> # rdate -s tick.greyware.com </code>
101 To display the time on the remote server, use the //rdate -p// command.
103 <code> $ rdate -p tick.greyware.com </code>
105 === Hwclock ===
107 //Hwclock// allows you to syncronize the time of your hardware clock to the system clock or vice versa.
109 Syncronize the system clock to the hardware clock (<nowiki> --utc = universal time, -l = local time </nowiki>):
111 <code> # hwclock -w --utc </code>
113 Syncronize the hardware clock to the system clock:
115 <code> # hwclock -s --utc </code>
117 ===== Execute scheduled commands =====
119 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//.
121 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:
123 <file> mm hh dd MMM DDD command > log </file>
125 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 its place you can use GNU nano (<Ctrl+X> to save & exit):
127 <code> # nano /var/spool/cron/crontabs/root </code>
129 Add the line:
131 <file> * * * * * date >> /tmp/crond.test </file>
133 Launch crond with the option //-b// (background), configured via ///etc/daemons.conf// and using the startup script:
135 <code> # /etc/init.d/crond start </code>
137 You can wait a few minutes and view the contents of the file: ///tmp/crond.test//... OK:
139 <code> # cat /tmp/crond.test </code>
141 To stop or restart the daemon crond:
143 <code>
144 # /etc/init.d/crond stop
145 Or :
146 # /etc/init.d/crond restart
147 </code>
149 === Invoke the daemon crond on every boot ===
151 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.
153 ===== Add commands to be executed at boot =====
155 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:
157 <code> # nano /etc/init.d/local.sh </code>