User:Djgreen/Linux Administration
Prep Machine for KickStart
- Make sure hostname has config file in /afs/bp/system/config/linux-kickstart/configs/ece
- Make sure host is using PXE-all DHCP template in QIP.
Rename Linux Boxes
If the machine is using dhcp I think you just need to switch in qip and reboot into the new lease / IP / hostname.
If the machine has a static configuration, you need to edit:
/etc/sysconfig/network-scripts/ifcfg-eth0
and
/etc/sysconfig/network
with the new values.
Try editing these files:
/etc/sysconfig/network
and
/etc/hosts
The hostname should be stored there.
After your box is on the network as the new name, run this command as root:
/usr/sbin/rhnreg_ks --force --activationkey <your_key_here>
Where <your_key_here> comes from the "activationkey" line in the web kickstart file. This will create a new "object" in red hat network.
Get Login Logs
in Linux, they have the /var/log/wtmp file but it is a binary file format. So the recommended interface is to use the last command.
last -n 100 will show the last 100 people who logged in.
You can also specify alternate wtmp files like
last -n 100 -f /var/log/wtmp.1
Controlling Access
It is possible to use pts groups to control access to Realm Linux.
cluster <cell> <PTS group>
is what goes in the config file. You can also hand edit /etc/update.conf if you don't want to re-install a box. It should look like this:
users blah XXXXXXXXXXXXXXXXXXXXXXXXXXX root blah XXXXXXXXXXXXXXXXXXXXXXXXXXX cluster> eos itecs-admin:helpdesk
where you replace the pts group with what group you want to use. If there is more than one pts group then you just add more cluster> lines.
Let us know if you need any further information. see also:
Remote Reinstall of Existing RHEL box
(11:45:53 AM) gsgatlin: djgreen: You can edit /boot/grub/grub.conf and change the default boot item to re-install this workstation.
(11:47:56 AM) gsgatlin: it starts numbering at 0 so if re-install is the first item it would be default=0, then you reboot and it starts installing.
Mount an NTFS drive
- yum -y install ntfs-3g
- installs ntfs kernel driver
- If it can't find that package, run rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm to add the EPEL repository as an option for yum
- mount -t ntfs-3g <device> <mount location>
- mounts drive to specified location. if connected by usb, drive will be under /dev/sdc, connected internally should be /dev/sda, though you'll likely have to mount a particular partition, like /dev/sdc2, etc
- the mount location must be an existing folder, so if you want to mount to /mnt/windows, you will have to create that windows folder under /mnt first
- example, mount -t ntfs-3g /dev/sdc2 /mnt, mounts the second partition of a usb ntfs drive under /mnt
- dmesg | tail -##
- gives you the last ## entries from the message buffer. Can use this to figure out if the drive is connected and where.
- cp -vau <source> <destination>
- for copying files off the drive. v is for verbose, a for archive, u for update. The destination must be an existing folder.
- don't know if it will stop if it hits an error
- example: (assuming the drive is mounted to /mnt) cp -vau /mnt/bob /local/backup, copies the bob folder from the drive and anything in it to /local/backup
- for copying files off the drive. v is for verbose, a for archive, u for update. The destination must be an existing folder.
Add users individually
sudo vi /etc/users.local.base
sudo vi /etc/users.local
- add their unity username
Add sudo
sudo su - visudo
- add as "username ALL=(ALL) ALL"
- any sudo users must also have been added to the two users.local files as well
Local Home Dir
[10:14] <djgreen> Micah -- anything I need to know about creating local user home folders (/home/*) in Linux? [10:15] <macolon> Umm... make sure that /home is a symlink to /local/home, aside from that, can't really think of anything. [10:16] <djgreen> how about perms? [10:17] <djgreen> just chown to the user and I'm ok? [10:17] <macolon> mkdir directory; chmod 700 directory; chown username.ncsu directory [10:17] <macolon> Assuming that no one else is supposed to access the dir. [10:18] <macolon> if it chokes on chown username.ncsu directory -- two steps then: chown username dir; chgrp ncsu dir
[11:09] <djgreen> Micah -- is there a way for someone to have /home/userid be set as their "homedir" when they login to a machine? Rather than their regular AFS home dir? [11:11] <macolon> setenv HOME /home/userid in .mycshrc
Repair DotFiles
[10:20] <elliot> /usr/bin/repair_dotfiles.sh will do it for linux [10:21] <elliot> make sure they run that from the root of their home directory