Finding linux disk space

Calling the following lists the disk space available on all mounted drives:

df -h

Here's some (painfully complex) output:

Filesystem            Size  Used Avail Use% Mounted on
tmpfs                  50M     0   50M   0% /lib/init/rw
udev                   10M  6.6M  3.5M  66% /dev
tmpfs                  50M     0   50M   0% /dev/shm
rootfs                1.9G  1.1G  759M  59% /
tmpfs                  50M  3.1M   47M   7% /tmp
ramlog-tmpfs           20M  2.4M   18M  12% /var/log
/dev/sda4             2.8T  169G  2.6T   7% /DataVolume

Posted by Scott Dupoy - 2012-01-23 21:41:09   (Edited 2012-01-23 21:46:07)
Adding a user to the sudoers file

For a linux user to be able to execute commands as root they need to execute using the sudo command. A user is not permitted to do this (even if they know the root password) unless they are in the sudoers file. To add a user to this file simply edit the sudoers file when logged in as root:

sudo vim /etc/sudoers

Then add the user. I've added the NOPASSWD: flag so that I don't have to always enter the root password. I don't normally do this but on this machine the root password is pain to type!

scott ALL=(ALL) NOPASSWD: ALL

Posted by Scott Dupoy - 2012-01-23 21:13:56
Enabling SSH access on linux

After creating a user using useradd you need to enable SSH access if the user is to be able to login to the machine remotely. This is done by editing the SSH daemon config file:

sudo vim /etc/ssh/sshd_config

Then add the user to the AllowUsers section (space separated):

AllowUsers root scott claire

For the changes to take effect restart SSH.

sudo /etc/init.d/sshd restart

Posted by Scott Dupoy - 2012-01-23 21:08:17   (Edited 2012-01-23 21:09:15)
View Scott Dupoy's profile on LinkedIn

© Scott Dupoy
Hits: 59254