Hi Friends I have link in "mentortask" with in the folder of "/etc/apache2/sites-enabled/" when I was try to delete that file using following command. it can't work and said can not remove permission denied when I am reload the apache server.
" rm /etc/apache2/sites-enabled/mentortask.com " and
" unlink /etc/apache2/sites-enabled/mentortask.com "
How will solve this problem.
sudo rm /etc/apache2/sites-enabled/mentortask.com
If you can't, then you need to petition the administrator to do it for you.
find ./{DirectoryName} -type l -print0 | xargs -0 ls -plah |tr -s ' ' | cut -f9 -d ' ' | xargs rm -rf
Related
I want to run a command to remove all files under the folder 'allfiles/'
root#admin:/home/admin/allfiles# find . -name '*' | xargs rm
and it clears all files under allfiles
I want to run the same command using Laravel Schedule, I am using in this way
protected function schedule(Schedule $schedule)
{
$schedule->exec('find . -name '*' | xargs rm /home/admin/millionfiles/')
->everyMinute();
}
But it does not work
You missed ' before the directory beginning
Also try adding double quotes instead of single
protected function schedule(Schedule $schedule) {
$schedule-> exec('find . -name "*" | xargs rm ' . '/home/admin/millionfiles/')
->everyMinute();
}
All emails in my Magento 1.9.2.4 shop : invoice , new registration , contact us.... not work. I recive error log 403.
I haven't make any changes on the site. Can the reason be in the cPanel?
You can run the following commands:
find ./ -type f | xargs chmod 644
find ./ -type d | xargs chmod 755
chmod -Rf 777 var
chmod -Rf 777 media
I have a text file "modules.txt" containing (individual module names):
dashboard
editor
images
inspector
loader
navigation
sharing
tags
toolbar
I want to create a folder structure for each module like:
dashboard/templates
editor/templates
flash/templates
images/templates
etc ...
I'm fiddling around in the area of:
cat modules.txt | xargs mkdir -p $1/templates
But this creates the first level of folders, ignoring the /templates part and giving and error:
mkdir: /templates: File exists
Which it does not.
I've tried all sort of combinations of:
cat modules.txt | xargs mkdir -p $1/{templates}
cat modules.txt | xargs mkdir -p $1{templates}
cat modules.txt | xargs mkdir -p $1/{templates}
cat modules.txt | xargs mkdir -p $1\/{templates}
(yes, pretty much guessing here)
I've also tried to add the /templates to each line in the text file, but that makes the whole thing crash.
Any ideas how to go about doing this?
Turns out, this did work when adding /templates to the text file. Must have been to tired (or stupid) when fiddling with this.
cat file_containing_folder_structure.txt | xargs mkdir -p
I found the number of files in /dev/shm/split/1/ to be 42806 using:
/bin/ls -lU /dev/shm/split/1/ | wc -l
What I can't seem to find anywhere online is how to select a certain range, say from 21404-42806, and use scp to securely copy those files. Then, for management purposes, I would like to move the files I copied to another folder, say /dev/shm/split/2/.
How do I do that using CentOS?
I tried:
sudo chmod 400 ~/emails/name.pem ; ls -1 /dev/shm/split/1/ | sed -n '21443,42806p' | xargs -i scp -i ~/emails/name.pem {} root#ipaddress:/dev/shm/split/2/
This produced:
no such file or directory
errors on all of the files...
ls itself lists files relative to the directory you give. This means your ls prints the filenames in the directory, but later on, scp doesn't have the path to them. You can fix this two ways:
Give the path to scp:
ls -1 /dev/shm/split/1/ | sed -n '21443,42806p' | xargs -i \
scp -i ~/emails/name.pem /dev/shm/split/1/{} root#ipaddress:/dev/shm/split/2/
Change to that directory and it will work:
cd /dev/shm/split/1/; ls -1 | sed -n '21443,42806p' | xargs -i \
scp -i ~/emails/name.pem {} root#ipaddress:/dev/shm/split/2/
I've installed Xenforo on my digitalocean VPS running CentOS 7, I get this error as soon as I open the web page. `The following errors occurred while verifying that your server can run XenForo:
The directory /var/www/html/data must be writable. Please change the permissions on this directory to be world writable (chmod 0777). If the directory does not exist, please create it.
The directory /var/www/html/internal_data must be writable. Please change the permissions on this directory to be world writable (chmod 0777). If the directory does not exist, please create it.
Please correct these errors and try again.
How would I change the permission for the directory so it can be world writable?
Basically data and internal_data are directories in which the user running Xenforo should be able to write, because they will contain attachments, avatar, and other files.
Usually the user running PHP on Apache or Nginx is www-data in the group www-data (user and group have the same name), so all you have to do is letting this user to write on data and internal_data:
chown -R www-data.www-data /var/www/html/data /var/www/html/internal_data
If you want to follow literally the advice given in the error message you can do this instead:
chmod -R 0777 /var/www/html/data /var/www/html/internal_data
But as others commented, this approach is more insecure, because it will permit any user in the system to write in data and internal_data directories.
This is what is recommended for Xenforo 2 on nginx on CentOS per CentMinMod & Xenforo documentation. It is required to do it like this or Xenforo2 will not work. I have used this on multiple sites without issue. Make a backup first to be safe.
find /home/nginx/domains/domain.com/public/ -type f -print0 | xargs -0 chmod 0644;
find /home/nginx/domains/domain.com/public/ -type d -print0 | xargs -0 chmod 0755;
find /home/nginx/domains/domain.com/public/internal_data/ -type f -print0 | xargs -0 chmod 0777;
find /home/nginx/domains/domain.com/public/data/ -type f -print0 | xargs -0 chmod 0777;
find /home/nginx/domains/domain.com/public/internal_data/ -type d -print0 | xargs -0 chmod 0777;
find /home/nginx/domains/domain.com/public/data/ -type d -print0 | xargs -0 chmod 0777;
chmod 0750 /home/nginx/domains/domain.com/public;