website view en/doc/handbook/system-admin.html @ rev 665

Update copyright year
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Oct 21 09:53:47 2010 +0200 (2010-10-21)
parents b8788d938e18
children 0ae6cfc85e03
line source
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <title>SliTaz Handbook (en) - System administration</title>
6 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
7 <meta name="description" content="slitaz English handbook" />
8 <meta name="expires" content="never" />
9 <meta name="modified" content="2008-07-18 06:00:00" />
10 <meta name="publisher" content="www.slitaz.org" />
11 <meta name="author" content="Christophe Lincoln"/>
12 <link rel="shortcut icon" href="favicon.ico" />
13 <link rel="stylesheet" type="text/css" href="book.css" />
14 </head>
15 <body bgcolor="#ffffff">
17 <!-- Header and quick navigation -->
18 <div id="header">
19 <div align="right" id="quicknav">
20 <a name="top"></a>
21 <a href="x-window.html">X Window System</a> |
22 <a href="index.html">Table of contents</a>
23 </div>
24 <h1><font color="#3E1220">SliTaz Handbook (en)</font></h1>
25 </div>
27 <!-- Content. -->
28 <div id="content">
29 <div class="content-right"></div>
31 <h2><font color="#df8f06">System administration</font></h2>
33 <ul>
34 <li><a href="system-admin.html#devices">Devices and disk access.</a></li>
35 <li><a href="system-admin.html#users-admin">Users, groups and passwords.</a></li>
36 <li><a href="system-admin.html#locale">Language and keyboard.</a></li>
37 <li><a href="system-admin.html#bash">Install the Bash shell.</a></li>
38 <li><a href="system-admin.html#editors">Text editors.</a></li>
39 <li><a href="system-admin.html#sudo">Sudo command.</a></li>
40 <li><a href="system-admin.html#time">Set the system time.</a></li>
41 <li><a href="system-admin.html#cron">Execute scheduled commands.</a></li>
42 <li><a href="system-admin.html#local.sh">Add commands at boot time.</a></li>
43 </ul>
45 <a name="devices"></a>
46 <h3>Devices and disk access</h3>
47 <p>
48 With Linux your disks and USB media are seen as devices. To access them you must
49 first mount a device on a mount point (directory). On SliTaz you can graphically
50 mount devices by using <code>mountbox</code> or the command line. To mount the
51 first disk of a local hard disk on <code>/mnt/disk</code>:
52 </p>
53 <pre>
54 # mkdir -p /mnt/disk
55 # mount /dev/hda1 /mnt/disk
56 </pre>
57 <p>
58 To mount a cdrom or an USB media you should use mount points located in
59 <code>/media</code>. Note that for a cdrom, you just have to specify
60 the device path. For a flash key, the mount point already exists:
61 </p>
62 <pre>
63 # mount /dev/cdrom
64 # mount /dev/sda1 /media/flash
65 </pre>
66 <h4>ntfs filesystem</h4>
67 <p>
68 If you need read/write access to Windows ntfs filesystems you must install a
69 few additional packages from the mirror. The <code>ntfs-3g</code> driver
70 provides stable access to ntfs partitions and <code>ntfsprogs</code> provides
71 manipulation tools dependent on <code>fuse</code>. Note that you can format, move or resize
72 ntfs partitions graphically with Gparted.
73 </p>
75 <a name="users-admin"></a>
76 <h3>Users, groups and passwords</h3>
77 <p>
78 To manage users and groups on your SliTaz system you must use the command line,
79 but file permissions can be changed graphically using the PCmanFM file manager. To
80 add or remove users and groups you must be root. Root can also change all
81 user passwords and a single user can only change his/her own password. To add
82 or remove a user named linux:
83 </p>
84 <pre>
85 # adduser linux
86 # deluser linux
87 </pre>
88 <p>
89 To add or remove a group you must use <code>addgroup</code> or
90 <code>delgroup</code>. To change the current user password or change the
91 password of a specific user, you must use the <code>passwd</code> command:
92 </p>
93 <pre>
94 $ passwd
95 # passwd username
96 </pre>
97 <h4>Audio group</h4>
98 <p>
99 If you want a new user to be able to listen to music he must be in the
100 <code>audio</code> group. To add an existing user to the audio group:
101 </p>
102 <pre>
103 # adduser -G audio user_name
104 </pre>
106 <a name="locale"></a>
107 <h3>Language and keyboard layout</h3>
108 <p>
109 SliTaz saves the configuration of the default locale in <code>/etc/locale.conf</code>
110 which is read by <code>/etc/profile</code> on each login and the keyboard
111 setting is stored in <code>/etc/kmap.conf</code>. These two files can be
112 edited with your favorite editor or configured respectively with
113 <code>tazlocale</code> and <code>tazkeymap</code>. You can modify the settings
114 you chose on the first boot by typing as root administrator:
115 </p>
116 <pre>
117 # tazlocale
118 Or:
119 # tazkeymap
120 </pre>
121 <p>
122 To check all available locales or your current configuration, you can use the
123 command <code>locale</code> as a single user or root (C for English):
124 </p>
125 <pre>
126 $ locale -a
127 $ locale
128 </pre>
130 <a name="bash"></a>
131 <h3>Bash Shell</h3>
132 <p>
133 On SliTaz you have the ash and sh shell with a link to Ash, this shell is
134 provided by Busybox. If you wish to use the Bash (Bourne Again SHell), first
135 as <code>root</code> install bash, copy the <code>.profile</code> found in your
136 home directory and rename it <code>.bashrc</code>, then edit the
137 <code>/etc/passwd</code> file with your favorite text editor and change your
138 shell to :/bin/bash
139 </p>
140 <pre>
141 # tazpkg get-install bash
142 # cp /home/hacker/.profile home/hacker/.bashrc
143 Note root user: cp /home/hacker/.profile ~/.bashrc
144 # nano /etc/passwd ~ :/bin/bash
145 </pre>
146 <p>
147 The next time you login bash will be your default shell, you can confirm this
148 by typing <code>env</code> on the command line.
149 </p>
151 <a name="editors"></a>
152 <h3>Editors</h3>
153 <p>
154 Busybox supplies a clone of vi for normal text editing, but it does have its limitations.
155 You can install the full vim editor with the command:
156 </p>
157 <pre> # tazpkg get-install vim
158 </pre>
159 <p>
160 Or alternatively if you prefer emacs, SliTaz offers a tiny version:
161 </p>
162 <pre> # tazpkg get-install emacs
163 </pre>
165 <a name="sudo"></a>
166 <h3>Sudo</h3>
167 <p>
168 The <code>sudo</code> command can be applied on SliTaz:
169 </p>
170 <pre> # tazpkg get-install sudo
171 </pre>
172 <p>
173 Note that the configuration file /etc/sudoers, should <em>always</em> be edited by the <code>visudo</code> command
174 which locks the file and checks for errors.
175 </p>
177 <a name="time"></a>
178 <h3>System Time</h3>
179 <p>
180 To know the current system time, you can simply type <code>date</code>. On
181 SliTaz, the timezone configuration file is saved in <code>/etc/TZ</code>, you
182 can edit with your favorite text editor or simply <code>echo</code> the changes.
183 To view the available timezones, you can look in the
184 <code>/usr/share/zoneinfo</code> directory.
185 Here's an example using the timezone Europe/London:
186 </p>
187 <pre>
188 # echo "Europe/London" &gt; /etc/TZ
189 </pre>
190 <h4>Rdate</h4>
191 <p>
192 To syncronize the system clock with a network time server, you can (as
193 <code>root</code>) use the <code>rdate -s</code> command:
194 </p>
195 <pre>
196 # rdate -s tick.greyware.com
197 </pre>
198 <p>
199 To display the time on the remote server, use the <code>rdate -p</code> command.
200 </p>
201 <pre> $ rdate -p tick.greyware.com
202 </pre>
203 <h4>Hwclock</h4>
204 <p>
205 Hwclock allows you to syncronize the time of your hardware clock to the system
206 clock or vice versa.
207 </p>
208 <p>
209 Syncronize the system clock to the hardware clock ( --utc = universal time,
210 -l = local time):
211 </p>
212 <pre>
213 # hwclock -w --utc
214 </pre>
215 <p>
216 Syncronize the hardware clock to the system clock:
217 </p>
218 <pre>
219 # hwclock -s --utc
220 </pre>
222 <a name="cron"></a>
223 <h3>Execute scheduled commands</h3>
224 <p>
225 The daemon 'crond' allows you to run commands automatically at a scheduled specific date or time. This is very
226 useful for routine tasks such as system administration. The directory cron uses is
227 <code>/var/spool/cron/crontabs</code>.
228 </p>
229 <p>
230 Each user of the system can have his/her own tasks, they are defined in the file: <code>/var/spool/cron/crontabs/user</code>.
231 The crontab utility allows you (amongst other things), to list the tasks specific to the user. The syntax of the
232 files is as follows:
233 </p>
234 <pre class="script">mm hh dd MMM DDD command &gt; log
235 </pre>
236 <p>
237 We will create a file with root priviledges and test the daemon 'crond' with a task performed every minute -
238 writing the date to a file /tmp/crond.test. It should be noted that the utility has an option
239 <code>crontab</code> for editing cron file using 'vi', this is not provided by SliTaz. In its place you can use
240 GNU nano (&lt;Ctrl+X&gt; to save &amp; exit):
241 </p>
242 <pre> # nano /var/spool/cron/crontabs/root
243 </pre>
244 <pre class="script">* * * * * date &gt;&gt; /tmp/crond.test
245 </pre>
246 <p>
247 Launch <code>crond</code> with the option <code>-b</code> (background),
248 configured via <code>/etc/daemons.conf</code> and using the startup script:
249 </p>
250 <pre> # /etc/init.d/crond start
251 </pre>
252 <p>
253 You can wait a few minutes and view the contents of the file: /tmp/crond.test... OK:
254 </p>
255 <pre> # cat /tmp/crond.test
256 </pre>
257 <p>
258 To stop or restart the daemon crond:
259 </p>
260 <pre> # /etc/init.d/crond stop
261 Or :
262 # /etc/init.d/crond restart
263 </pre>
264 <h4>Invoke the daemon crond on every boot</h4>
265 <p>
266 To launch the daemon 'crond' each time you boot the system, just add it to the variable <code>START_DAEMONS</code>
267 in the configuration file <code>/etc/rcS.conf</code>, either before or after the web server or SSH server.
268 </p>
270 <a name="local.sh"></a>
271 <h3>Add commands to be executed at boot</h3>
272 <p>
273 During the boot process, various scripts are executed to configure services, such as the start of the
274 web server, networking, etc. On SliTaz there is a script <code>/etc/init.d/local.sh</code> which allows
275 you to add commands to be launched at system startup. You can also create new scripts in /etc/init.d,
276 their links in /etc/rc.scripts for shell scripts and use /etc/rc.d for links to the startup script daemon in
277 /etc/rcS.conf:
278 </p>
279 <pre> # nano /etc/init.d/local.sh
280 </pre>
282 <!-- End of content -->
283 </div>
285 <!-- Footer. -->
286 <div id="footer">
287 <div class="footer-right"></div>
288 <a href="system-admin.html#top">Top of the page</a> |
289 <a href="index.html">Table of contents</a>
290 </div>
292 <div id="copy">
293 Copyright &copy; 2010 <a href="http://www.slitaz.org/en/">SliTaz</a> -
294 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>;<br />
295 Documentation is under
296 <a href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>
297 and code is <a href="http://validator.w3.org/">valid xHTML 1.0</a>.
298 </div>
300 </body>
301 </html>