Setup a linux box

Example lead - highlighted near the title

Setup a linux box
Page content

Linux post installation guide

[[TOC]]

Mounting external drives

Google drive

Run the following installation steps

$ sudo add-apt-repository ppa:alessandro-strada/ppa
$ sudo apt-get update
$ sudo apt-get install google-drive-ocamlfuse

Once successfully installed, authorize google-drive-ocamlfuse client with your desired Google account using the following command.

$ google-drive-ocamlfuse

This is going to pop open a page on your browser where Google will request you to choose a Gmail account to continue with the setup

Finally, create a mount point in your home directory and mount the directory

$ mkdir ~/google-drive
$ google-drive-ocamlfuse ~/google-drive

For a full description with pictures click here

Dropbox drive

To install the Dropbox Drive click here

mounting disks

Edit the /etc/ftab file as root. Add the following lines

192.168.6.64:/Public    /mnt/nfs_6_64           nfs     vers=3,defaults 0 0
192.168.8.7:/Public     /mnt/nfs_8_7            nfs     vers=3,defaults 0 0
192.168.6.15:/PALM      /mnt/PALM_dataserv      nfs     vers=3,noatime,nodiratime,noacl,nocto,bg 0 0
192.168.8.9:/Public    /mnt/nfs_8_9             nfs     defaults 0 0
192.168.8.60:/data/tronador     /mnt/tronador   nfs defaults    0 0
192.168.6.30:/GREY     /mnt/grey   nfs defaults    0 0
192.168.8.12:/GLACIER/disk1    /mnt/GLACIER_disk1   nfs defaults 0 0
192.168.8.12:/GLACIER/disk3    /mnt/GLACIER_disk3   nfs defaults 0 0
192.168.6.173:/DataVolume/Public /mnt/nfs_WD    nfs     vers=3,defaults 0 0

then run

mkdir /mnt/nfs_6_64 /mnt/nfs_8_7 /mnt/PALM_dataserv /mnt/nfs_8_9  
chmod 777 /mnt/nfs_6_64 /mnt/nfs_8_7 /mnt/PALM_dataserv /mnt/nfs_8_9  /mnt/GLACIER_disk3  /mnt/GLACIER_disk1

mkdir /mnt/GLACIER_disk4 /mnt/tronador /mnt/grey /mnt/GLACIER_disk1  /mnt/GLACIER_disk3
chmod 777 /mnt/GLACIER_disk1 /mnt/tronador /mnt/grey

then you can mount any drive by its name in the /etc/fstab file or its directory mountpoint. For instance:

mount /mnt/grey

Other configurations

Setting up login with a public key

in client do:

> ssh-keygen

enter for passphrase

cat ~/.ssh/id_rsa.pub | ssh marcnol@krakatoa "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

done!

If for some reason, you still need to enter a password after setting up RSA then it may be because your .ssd directory in the server side has permissions that your ssh does not like.

To check this do:

tail /var/log/auth.log

and you may see something like:

Sep 24 13:02:17 krakatoa sshd[122249]: Authentication refused: bad ownership or modes for file /home/marcnol/.ssh/authorized_keys

To solve it do:

chmod 700 -R ~/.ssh

Use crontab to automate services

This example will show how to run a script rsync_home.sh at 22:00 every day. Start by running:

crontab -e

and add

0 22 * * * runuser -l marcnol -c '/home/marcnol/sysadm/rsync_home.sh'

then run

mkdir /home/marcnol/sysadm

create /home/marcnol/sysadm/rsync_home.sh and add:

date >> /home/marcnol/sysadm/last_backup.log
rsync -avz --delete /home/marcnol /mnt/PALM_dataserv/DATA/BCKUSER > /home/marcnol/sysadm/rsync_home.log

Setup of linux boxes

creating group cbs and changing User ID

do

vi /etc/group
cbs:x:1000:marcnol

then for marcnol do:

vi /etc/passwd
marcnol:x:UID:1000:Marcelo Nollmann:/home/marcnol:/bin/tcsh

and replace UID by your desired user ID.

You can also change the uid of a user by doing:

usermode -u 1002 rata
chown rata:users -R /home/rata

Creating sysadm and giving root privileges

useradd sysadm --uid 1001 --home /home/sysadm --create-home --groups root --gid 0
visudo

add < sysadm ALL=(ALL) ALL > to the “User privilege specification” section

Find the entry for %wheel. This is the wheel group. The ‘%’ tells sudo to match vs a # group name in /etc/groups. Uncomment the line so it looks like:

%wheel        ALL=(ALL)       ALL

Save and exit with :wq (not necessary when using gedit or kate) Add the desired username to the wheel group.The new group is effective for given user #after new login.

/usr/sbin/usermod -G wheel sysadm

Edit the sudoers file again. This time remove the ability for every user to run sudo. #Comment out these lines, save and exit.

#Defaults targetpw    # ask for the password of the target user i.e. root
#ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults targetpw'!

changing permissions to files in PALM_dataserv

chown -R 10XX:1000 /home/user chown -R 10XX:1000 /data

chown -R 2701:1000 /home/hernan chown -R 2648:1000 /home/cardozo

Activation compte root (pour faire > su)

 > sudo passwd root

network

network configuration in ubuntu

do

> vi /etc/network/interfaces :

then modify as follows:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.6.13
netmask 255.255.255.0
gateway 192.168.6.1
dns-nameservers 192.168.2.10 192.168.1.10
dns-search intranet.fr

the run

> vi /etc/resolv.conf :

and modify as follows:

nameserver  192.168.2.10
nameserver  192.168.1.10
search intranet.fr

Activation sshd

> apt-get install ssh

puis, ajout dans /etc/rc.local :

if [ ! -d /var/run/sshd ]; then
   mkdir /var/run/sshd
   chmod 0755 /var/run/sshd
fi
/usr/sbin/sshd
exit 0

NFS (pour disque centraux des comptes utilisateurs (mais ca peut être aussi : AFM, FLUO, PALM ….)

> vi /etc/fstab 
# CBS
192.168.2.6:/CMPT /CMPT nfs vers=3,bg 0 0
192.168.2.11:/CMPT2 /CMPT2 nfs vers=3,bg 0 0

CSH (necessaire pour certains comptes )

>apt-get install csh
>apt-get install tcsh
>unlink /bin/csh; ln -s /bin/tcsh /bin/csh