wget permission denied
This is the common error that appeared on cPanel server mostly on shared/reseler servers. This happen when user try to run cron with wget or if try to download any file through jailshell and they have no permission to run wget command.
If you type command which wget command on server then output will be,
root@server[~]# which wget
Now you need to check the permission and ownership of wget binary. Type ll /usr/bin/wget on shell. ll output would be like this,
root@server [~]# ll /usr/bin/wget
-rwxr-x— 1 root root 244308 Nov 3 2009 /usr/bin/wget*
By default permissions assigned to /usr/bin/wget is 750 and ownership is root.root.
From the above output you can see that only root user is allowed to use wget as permission for others has been disabled. In order to grant wget permission for cPanel user you can assign 755 permision to /usr/bin/wget but it is huge risk with the server security. Because all users can have access to wget command by changing it’s permission which is not recommended. But you can give privilege of wget to specific user those are really need it.
Follow the given steps.
Login to server with root user.
First add group wget-users with groupadd command
root@server [~]#groupadd wget-users
Then change the ownsership of wget binary as
root@server [~]#chown root.wget-users /usr/bin/wget
Once you done this modify the cpanel user account by usermod command that require to run wget
root@server [~]#usermod -g wget-users username Replace username with actual cPanel user.
Here we have added cPanel user into wget-users group. Confirm it with the following command if it has correct group
grep username /etc/group