Linux Admin: Difference between revisions

From miki
Jump to navigation Jump to search
(→‎File Systems: Reiserfs performance tweaks)
Line 38: Line 38:
=== Reiserfs ===
=== Reiserfs ===
* For better performance, use mount switch <code>noatime,notail</code> (see [http://www.funtoo.org/en/articles/linux/ffg/2/])
* For better performance, use mount switch <code>noatime,notail</code> (see [http://www.funtoo.org/en/articles/linux/ffg/2/])

== udev & devfs ==
Reference: [http://www.reactivated.net/writing_udev_rules.html]

This chapter is about the devices in '''<tt>/dev</tt>'''. Since kernel 2.6, the content of this directory is generated by '''udev''' ''rules''.

These rules are located at:
* <tt>/lib/udev/rules.d</tt>
* <tt>/etc/udev/rules.d</tt> (these can be customized)

Use '''udevadm''' to get information on a given device:
<source lang="bash">
udevadm info -q path -n /dev/sda2 # To get the path to the device /dev/sda2
udevadm info -q -n /dev/sda2 # To get all the attributes of device /dev/sda2
udevadm info -a -p $(udevadm info -q path -n /dev/sda2) # Same as above
udevadm test $(udevadm info -q path -n /dev/sda2) 2>&1 | grep OWNER # Test the effect of a new rule on device /dev/sda2
</source>

Revision as of 15:33, 31 May 2010

/etc/sudoers

The man page gives a complete but unclear description of the file specification. Here a simplified but complete version:

First the description of possible entries in the file:

# Alias
'User_Alias'  NAME '=' User...         (':' NAME '=' User...        )*  |
'Runas_Alias' NAME '=' Runas_Member... (':' NAME '=' Runas_Member...)*  |
'Host_Alias'  NAME '=' Host...         (':' NAME '=' Host...        )*  |
'Cmnd_Alias'  NAME '=' Cmnd...         (':' NAME '=' Cmnd...        )*

#Default_Entry
'Defaults' ('@' Host... | ':' User... | '!' Cmnd... | '>' Runas_Member...)? Parameter...

#User_Spec
User... Host... '=' Cmnd_Spec...       (':' Host... '=' Cmnd_Spec...)*

Now the description of the syntactical elements:

identifier... ::= identifier (',' identifier)*

NAME          ::= [A-Z]([a-z][A-Z][0-9]_)*

User /
Runas_Member  ::= '!'* ( username | '#'uid | '%'group | '+'netgroup | Alias | 'ALL' )

Host          ::= '!'* ( hostname | ip_addr | network(/netmask)? | '+'netgroup | Alias| 'ALL' )

Cmnd          ::= '!'* ( command filename (args | '""')? | directory | "sudoedit" | Alias | 'ALL' )

Parameter     ::= Parameter '=' Value | Parameter '+=' Value | Parameter '-=' Value | '!'* Parameter

Cmnd_Spec     ::= ('(' Runas_Member...? (':' ...? ')')? ('NOPASSWD:'|'PASSWD:'|'NOEXEC:'|'EXEC:'|'SETENV:'|'NOSETENV:')* Cmnd

File Systems

Reiserfs

  • For better performance, use mount switch noatime,notail (see [1])

udev & devfs

Reference: [2]

This chapter is about the devices in /dev. Since kernel 2.6, the content of this directory is generated by udev rules.

These rules are located at:

  • /lib/udev/rules.d
  • /etc/udev/rules.d (these can be customized)

Use udevadm to get information on a given device:

udevadm info -q path -n /dev/sda2                                     # To get the path to the device /dev/sda2
udevadm info -q -n /dev/sda2                                          # To get all the attributes of device /dev/sda2
udevadm info -a -p $(udevadm info -q path -n /dev/sda2)               # Same as above
udevadm test $(udevadm info -q path -n /dev/sda2) 2>&1 | grep OWNER   # Test the effect of a new rule on device /dev/sda2