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

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