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