How to mount a remote directory using SSH via SSHFS

Standard

From: http://www.linuxnix.com/2011/03/mount-directory-locally-linux-sshfs.html

Step1:Installing Package

On Ubuntu/Debain

On Redhat/CentOS/Fedora

Step2:Once the package is installed we have to create a mount point and mount our  server data using sshfs command, for which we require  user-name/password. Here are my details for this task.

Now create the mount point and mount SSH account data.

Step3:Testing our set-up

Check if you are able to see the SSH data

#cd /mnt/ssh

#ls

Sample output

What about df -hs command output?

Sample output

Step4:So what about mounting it permanently?. We can do it by editing fstab file in /etc folder

go to last line and type below line

Save the file and exit. Now run mount -a to update the fstab file state to kernel.

Let me explain what entry in fstab indicates. We are mentioning mount user root data which is located on 10.233.10.212 server on to /mnt/ssh using fuse file system with default settings.

Step5:What about unmounting this drive?

Enjoy new learning of mounting a folder using SSH protocol.

929 total views, no views today

Delete Files Older Than x Days on Linux

Standard

Delete Files Older Than x Days on Linux
The find utility on linux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We’ll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them.

Command Syntax

Note that there are spaces between rm, {}, and \;

Explanation

The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.
The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.
The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command.
This should work on Ubuntu, Suse, Redhat, or pretty much any version of linux.

543 total views, no views today