website annotate en/doc/handbook/system-admin.html @ rev 554

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