Checking cpanel crontab user files.
Via root SSH access, either of the following commands may be used to list the contents:
# crontab -l -u username
# cat /var/spool/cron/username
usage: crontab
usage: crontab [-u user] file
crontab [-u user] { -e | -l | -r }
-e (edit user’s crontab)
-l (list user’s crontab)
-r (delete user’s crontab)
-i (prompt before deleting user’s crontab)
Backing up your files with rsync
rsync makes the task a lot easier as it only downloads files that have changed - saving time and bandwidth.
Setup ssh keys so that you don’t need to enter a password each time you attempt to rsync folders.
On the destination server, the command is as follows:
rsync -e ’ssh -p 2222′ -avl –delete –stats –progress root@192.168.1.1:/home/buddy /backup/
-e ’ssh -p 2222′: this ensures rsync uses the SSH protocol and sets the port.
-avl: This contains three options;
(a) is archive mode which basically keep the permission settings for the files.
(v) is verbose mode. You can leave it out or increase it by appending two v’s (-vv).
(l) preserves any links you may have created.
–delete: deletes files from the destination folder that are no longer required (i.e. they have been deleted from the folder being backed up).
–stats: Adds a little more output regarding the file transfer status.
–progress: shows the progress of each file transfer. Can be useful to know if you have large files being backup up.
rsync - exclude files and folders
First - define the files and folders you want to exclude from the rsync:
To do this create a file called ‘exclude.txt’ on the destination machine (the system you give the rsync command on):
pico /home/buddy/exclude.txt
Now we have defined what to exclude we can direct rsync to the file with:
–exclude-from ‘/home/buddy/exclude.txt’
The final command would be:
rsync -e ’ssh -p 2222′ -avl –delete –stats –progress –exclude-from ‘/home/buddy/exclude.txt’ root@192.168.1.1:/home/buddy /backup/
Linux assigns the file permissions of the new file using your default UID and GID. To allow others access to the file, you need to either change the security permissions for the everyone security group or assign the file a different default group that contains other users.
This can be a pain in a large environment if you want to create and share documents among several people. Fortunately, there’s a simple solution for how to solve this problem.
There are three additional bits of information that Linux stores for each file and directory.
The set user id (SUID): When a file is executed by a user, the program runs under the permissions of the file owner.
The set group id (SGID): For a file, the program runs under the permissions of the file group. For a directory, new files created in the directory use the directory group as the default group.
The sticky bit: The file remains (sticks) in memory after the process ends.
The SGID bit is important for sharing files. By enabling the SGID bit, you can force all new files created in a shared directory to be owned by the directory’s group and now the individual user’s group.
The SGID is set using the chmod command. It’s added to the beginning of the standard three digit octal value (making a four-digit octal value), or you can use the symbol s in symbolic mode.
The Linux system identifies hardware devices as special files, called device files. There are three
different classifications of device files:
? Character
? Block
? Network
Character device files are for devices that can only handle data one character at a time. Most types
of modems and terminals are created as character files. Block files are for devices that can handle
data in large blocks at a time, such as disk drives.
The network file types are used for devices that use packets to send and receive data. This includes network cards and a special loopback device that allows the Linux system to communicate with itself using common network programming protocols.