Linux - Admin friendly
From Blue-IT.org Wiki
Contents
System
Change UID and GID
In some rare cases - e.g. when changing a disk with home directories between distributions - it might be necessary to change recursively the GID and UID's for the new system:
usermod -u <NEWUID> <LOGIN> groupmod -g <NEWGID> <GROUP> find / -user <OLDUID> -exec chown <NEWUID> {} \; find / -group <OLDGID> -exec chgrp <NEWGID> {} \;
Change directory and file permissions
When you like to change certain directories recursively - e.g. when these are defect or for security issues, you can use the find command.
You can use this command for different issues - not only for changing the write permissions:
Search and change changing all directories with name public_html:
find . -type d -name public_html -exec chmod 0755 {} \;
Repair all permission settings recursively is a two step process. First recursively make everything read, write and executable. Then in a second step just alter the files:
chmod -R 775 yourDirectory find yourDirectory/. -type f -exec chmod 0664 {} \;
Renaming a disk label and setting a mount point
When automounting USB sticks or external USB drives e.g. nautilus uses the disk label for showing up the drive. This could be anoying depending on what the disk label is.
Renaming ext3 disk labels
Use the e2label tool.
DEVICE="/dev/disk/by-id/usb-somthing-part1" umount "${DEVICE}" && e2label "${DEVICE}" THE_NEW_NAME
Renaming an USB stick
Use the mtools package. The program mlabel provides the necessary functions.
sudo mlabel -i /dev/sdbX ::"NewLabel"
Zenity
--progress
#!/bin/bash COMMAND="$1" SERVER="$2" ( echo "30" ; sleep 1 echo "# Verbindung zu $SERVER wird geprüft."; ping -c2 $SERVER echo "60" ; sleep 1 echo "# Programm $COMMAND wird gestartet." ; /usr/bin/ssh -ACX ${SERVER} "dbus-launch ${COMMAND}" echo "80" ; sleep 1 echo "# Programm wurde gestartet." echo "100" ; sleep 1 ) | zenity --progress \ --title="Starten von $COMMAND auf Rechner $SERVER" \ --text="Bitte warten Sie, während das Programm $COMMAND gestartet wird ..." \ --auto-close --auto-kill \ --percentage=0 if [ "$?" = -1 ] ; then zenity --error \ --text="Der Computer $SERVER konnte über das Netzwerk \ nicht erreicht werden.\n\nIst er eingeschaltet?" fi
CUPS
SuSE 10.1
To enable browsing via the network you have to setup a password for user root: See on you local [file:///usr/share/doc/manual/suselinux-manual_en/manual/sec.p.special.html SuSE Documentation]:
lppasswd -g sys -a CUPS-admin-name
Now you should configure your cups server via yast allowing some network clients to admin the printers.
LVM
Ubuntu Feisty
Found in Ubuntu Forums.
Search for the latest fedora system-config-lvm, e.g. via rpmfind.net and download it
wget ftp://rpmfind.net/linux/fedora/releases/7/Everything/i386/os/Fedora/system-config-lvm-1.1.1-1.0.fc7.noarch.rpm
Install alien:
apt-get install alien
And convert the rpm into a debian package and install it.
alien -d system-config-lvm-1.1.1-1.0.fc7.noarch.rpm dpkg -i system-config-lvm_1.1.1-2_all.deb
Ubuntu works with python2.5, so make a symlink as follows
ln -s /usr/bin/python2.5 /usr/bin/python2
Either start directly from a terminal or create a starter in menu->administration with
gksudo system-config-lvm
Be aware that all changes to lvm will take effekt emediately - so be careful what you do!