Difference between revisions of "User:Djgreen/Linux Administration"

From WolfTech
Jump to navigation Jump to search
Line 71: Line 71:
 
==Mount an NTFS drive==
 
==Mount an NTFS drive==
  
* yum -y install ntfs-3g
+
* '''yum -y install ntfs-3g'''
 
** installs ntfs kernel driver
 
** 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
+
** 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>
+
* '''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
 
** 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
 
** 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
+
** example, '''mount -t ntfs-3g /dev/sdc2 /mnt''', mounts the second partition of a usb ntfs drive under /mnt
  
* dmesg | tail -##
+
* '''dmesg | tail -##'''
 
** gives you the last ## entries from the message buffer.  Can use this to figure out if the drive is connected and where.
 
** 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
  
 
==Add users individually==
 
==Add users individually==

Revision as of 12:15, 9 September 2010

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:

https://secure.linux.ncsu.edu/moin/Realm%20Linux%20Administrators%27%20Guide/Controlling%20User%20Access

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

  • 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

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