Archive for the tag 'mounting'

Disable Mounting of Uncommon Filesystem Types

Append the following lines to /etc/modprobe.conf in order to prevent the usage of uncommon filesystem types:

install cramfs /bin/true
install freevxfs /bin/true
install jffs2 /bin/true
install hfs /bin/true
install hfsplus /bin/true
install squashfs /bin/true
install udf /bin/true

Using the install command inside /etc/modprobe.conf instructs the kernel module loading system to run the command specified (here, /bin/true) instead of inserting the module in the kernel as normal. This effectively prevents usage of these uncommon filesystems.

Mounting confusion /proc comes to the rescue

If you are losing track of what’s mounted, and in what state? No problem, here comes /proc to the rescue:

cat /proc/mounts

This displays all mounted filesystems, the filesystem types, read/write status, and other attributes. How many hard drives are on the system? One of these will tell you and also, SCSI drives are sd, IDE are hd.

fdisk -l

or

dmesg | grep hd

or

dmesg | grep sd
SBDavid

Control mounting a file system

Control mounting a file system

You can have more control on mounting a file system like /home and /tmp partitions with some nifty options like noexec, nodev, and nosuid. This can be setup in the /etc/fstab text file. The fstab file contains descriptive information about the various file systems mount options; each line addresses one file system.

Details regarding to security options in the fstab text are:

defaults: Allow everything quota, read-write, and suid on this partition.
noquota: Do not set users quotas on this partition.
nosuid: Do not set SUID/SGID access on this partition.
nodev: Do not set character or special devices access on this partition.
noexec: Do not set execution of any binaries on this partition.
quota: Allow users quotas on this partition.
ro: Allow read-only on this partition.
rw: Allow read-write on this partition.
suid: Allow SUID/SGID access on this partition.

More information can be found in the mount(8) man pages

SSHfs: mounting remote filesystem over ssh?

What is sshfs ?

SSHFS is a filesystem client based on the SSH File Transfer Protocol. It uses the the Filesystem in userspace (FUSE) framework by Miklos Szeredi.

Advantages of SSHFS

While sshfs may not be as fast and featureful as other full-blown network filesystems such as NFS or Samba, it still has some great features:

1. Very easy to use, on the server side there’s nothing to do, on the client side mounting the filesystem is as easy as logging into the server with ssh

2. Provides secure (encrypted) access to remote files

3. Has decent performance (multithreaded, caching directory contents and allowing large reads)

4. Should work well even over slow and/or unstable links (think dialup), knows how to reconnect to the server when the connection is broken

Requirements

Fuse Kernel module must be installed and loaded before using sshfs.

Packages Required

1. Kernel Source ( for the current running kernel )

2. FUSE : http://jaist.dl.sourceforge.net/sourceforge/fuse/fuse-2.5.3.tar.gz

3. SSHFS-FUSE : http://jaist.dl.sourceforge.net/sourceforge/fuse/sshfs-fuse-1.6.tar.gz

4. OpenSSH client

Installing and configuring SSHFS

Installing FUSE

1. Download the FUSE kernel module source from http://jaist.dl.sourceforge.net/sourceforge/fuse/fuse-2.5.3.tar.gz
#wget http://jaist.dl.sourceforge.net/sourceforge/fuse/fuse-2.5.3.tar.gz

2. Go to your kernel source directory and prepare it if it is a fresh kernel source

#cd /usr/src/linux-2.6.9-5.EL
#make menuconfig

3. Untar the FUSE package and change directory to the source directory of FUSE

#tar xzf fuse-2.5.3.tar.gz
#cd fuse-2.5.3

4. Configure the Fuse source package .

#./configure –with-kernel=/usr/src/linux-2.6.9-5.EL

5. Build the fuse module and install it

#make
#make install

6. Load Fuse module into kernel

#modprobe fuse

Installing SSHFS

1. Download the sshfs-fuse package from http://jaist.dl.sourceforge.net/sourceforge/fuse/sshfs-fuse-1.6.tar.gz

#wget http://jaist.dl.sourceforge.net/sourceforge/fuse/sshfs-fuse-1.6.tar.gz

2. Untar the source package and change directory to sshfs-fuse source directory

#tar xzf sshfs-fuse-1.6.tar.gz
#cd sshfs-fuse-1.6

3. Build and install the sshfs

#./configure
#make
#make install

Using SSHFS

You can mount a remote directory using the command sshfs @host: eg:

#sshfs user1@192.168.1.215:/docs docs

If the sshd on remote server is listening on an alternateport, you can use -oport= eg: For sshd listening on 2222

#sshfs -oport=2222 user1@192.168.1.215:/docs docs

To unmount the filesystem, you can use fusermount -u eg:

#fusermount -u docs