Showing posts from November, 2016

LINUX SSH: How can I recursively change the permissions of files and directories?

Just add the -R option to recursively change the permissions of files. An example, recursively add read and write permissions for the owner and group on foldername: chmod -R ug+rw foldername Permissions will be like 664 or 775. Setting the permissions to 777 is highly discouraged. You get errors in either Apache or your editor regarding permissions because apache runs under a different user (www-data) than you. If you want to write to /var/www, add yourself to the www-data group and set umask+permissions accordingly. Add yourself to the www-data group: sudo adduser $USER www-dataChange the ownership of the files in /var/www: sudo chown -R www-data:www-data /var/wwwChange the umask, so newly created files by Apache grants write permissions to the group too. Add umask 007 to /etc/apache2/envvars.Grant yourself (technically, the group www-data) write permissions: sudo chmod -R g+w /var/www. 17down vote bruteforce: sudo find foldername -exec chmod a+rwx {} ";" What does not work?…

Enable Apache Gzip Compression (mod_deflate) Globally in WHM/CPanel for All Domains

Enable Apache Gzip Compression (mod_deflate) Globally in WHM/CPanel for All Domains
Apache mod_deflate module is responsible for the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network. mod_deflate is the replacement of mod_gzip which was used with older version of Apache. If you are having only cPanel access (user interface), Then read following article to enable Apache Gzip Compression in account. If you have root access of WHM, you can enable Apache mod_deflate globally in WHM for all cPanel users. This article will help you to do so. If you are doing or existing server, you may read and understand about its working and impacts on running sites. Follow the below steps to enable apache gzip compression ( mod_deflate ) settings for all cPanel accounts. Step 1: Login to WHM Panel For making changes globally, its necessory to have WHM root access. Login to your WHM system Step 2: Edit Apac…

SMTP RESTRICTION: How can i disable php mail function in CLOUDLINUX

This is the way I do it. 
It's the only method I've been able to figure out, and there might be a much better way to do it, but it works for me. 

1. Edit /etc/cl.selector/php.conf 

2. Add these lines right at the top of the file: 
CodeDirective = sendmail_path Default   = /bin/true Type     = list Range    = /usr/sbin/sendmail -t -i,/bin/true Comment   = Switch to /bin/true to disable php mail 3. In the client's cpanel, change the sendmail path to /bin/true using "Select PHP Version > Switch to PHP Settings" 
He will no longer be able to send via php mail

The even better approach is to change this settings in global ini file through the following guideline:

[CageFS 6.0-33 or higher, LVE Manager 2.0-11.2 or higher]
There is /etc/cl.selector/global_php.inifile, where you can specify values of PHP options that should be applied for all Alt-PHP versions that are installed on a server. These settings will also be automatically applied to the new Alt-PHP versions that will…

How To Change Permission of files/folders through SSH Recursively? CHOWN

Recursive mode only works on directories, not files. By using the glob '*.pdf' the shell is passing the file list to chown, which sees these are files, and changes the permissions on the files it sees, and that's it. Remember, in shells, the glob is evaluated by the shell, not the command. If the glob matches files, they are passed to the command and the command never knows a glob existed. (This is different than how Windows Command prompt used to do things). If you have a dir, with the contents something like: machine:$ ls -F file1.pdf file2.pdf other.txt subdir/ And you typed: chown -R someuser:somegroup *.pdf The shell would first make the list: file1.pdf file2.pdf and then run your command: chown -R someuser:somegroup file1.pdf file2.pdf See, there's no directory for -R to act on. It does what you asked it - change ownership on the two files on the command line, ignoring that quirky -R flag. To do what you want, to use the '*.pdf' as a pattern for this …