Friday, July 12, 2013

Linux : crontab permission denied

Linux : user can't create/update crontabs
Crontab permission denied for Linux user
Allow user to create crontabs on Linux

By default the permission of file /usr/bin/crontab is
 -rwxr-xr-x 1 root root 34784 Apr 11 10:58 /usr/bin/crontab
Only root can create/update/delete crons.

If you want to allow user to create crons on Linux system, follow this.

a) If you are using CentOS, Fedora or RHEL
The permissions of crontab file should be
 -rwsr-xr-x 1 root root 34784 Apr 11 10:58 /usr/bin/crontab 
Owner and Group both should be root for the file as well as SUID bit should be set.
The ‘s’ in user field in place of ‘x’ indicates that SUID bit is set. 
To set SUID, Run following command
# chmod 4755 /usr/bin/crontab
or
# chmod u+s /usr/bin/crontab

b) If you are using Debian or ubuntu
The permissions of crontab file should be 
 -rwxr-sr-x 1 root crontab 34784 Apr 11 10:58 /usr/bin/crontab 
Owner should be root but the Group should be crontab as well as SGID bit should be set.
The ‘s’ in group in place of ‘x’ indicates that SGID bit is set.  
To make Group 'crontab', run following command.
# chgrp crontab /usr/bin/crontab
To set SGID, Run following command
# chmod 2755 /usr/bin/crontab
or
# chmod g+s /usr/bin/crontab

Filezilla - Response:530 Sorry, the maximum number of clients (n) from your host are already connected

Filezilla - Response:530 Sorry, the maximum number of clients (n) from your host are already connected

Solution 1
Open filezilla.
File -> site manager -> select your 'My Sites' entry -> transfer settings -> uncheck the check box "Limit number of simultaneous connections"

Try again.

Solution 2 -
Close all connections of same site. Do not open multiple filezilla instances for same site.

Restart filezilla.

Create mysql user for remote host log in

Log into mysql server from remote host

I am showing you a method to create mysql user for remote login.

I am going to give it all privileges so be careful. The details should not be given in wrong hands.

Create a user using following commands. Select any username and any password of your choice.
mysql> GRANT USAGE ON *.* TO 'new-username'@'%' IDENTIFIED BY 'new-password';
Now run this command. Use same username and password which you used in above command.
mysql> GRANT ALL PRIVILEGES ON *.* TO 'above-username'@'%' IDENTIFIED BY 'above-password' WITH GRANT OPTION;
Restart mysql.

Suppose my username is elex and password is linuxamination. My system's IP is 192.168.1.7. Now another user of my LAN whose IP is 192.168.1.8 wants to connect to my system's mysql server.

The other user should open it's terminal and run following command.
# mysql -h 192.168.1.7 -u elex -p'linuxamination'

Now 1.8 is  logged into my mysql server. Since user elex has full privileges so 1.8 can update/drop any database.