ls -al | awk ' $7 >= 3 && $7 <= 27 && $8==2015 {print $9}' | xargs rm -f
Correct file permissions for WordPress
What permissions should I have for the following:
- root folder storing all the WordPress content
- wp-admin
- wp-content
- wp-includes
And then all the files in each of those folders?
Here is the correct file permissions for WordPress:
To set correct permissions you need to use these commands:
chown www-data:www-data -R * # Let apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
The following modules failed while saving their changes, their state is unknown: samba
I have an old desktop running Zentyal 3. I set it up as a file sharing machine and for more than a year it worked just fine. For some odd reason, the samba module stopped saving the ACLs and Zentyal threw the following error:
Some modules reported error when saving changes. More information on the logs
in /var/log/zentyal/
The following modules failed while saving their changes, their state is
unknown: samba
On a closer look in the zentyal.log file the following message captured my eye:
Failed to save changes in module samba: Could not get ticket: could not
acquire credentials using an initial credentials context: No ENC-TS found
After searching around a bit, I found the answer on a two year old bug on Zentyal bugtracker. I just had to run the next command as root:
samba-tool user setexpiry administrator --noexpiry
It would appear that the administrator password expired.
How to reset the MySQL root password
The following steps describe the procedure to reset the MySQL root password on Linux.
1) Stop the mysql server
/etc/init.d/mysql stop
2) Start the MySQL server manually without permission tables which allows us to login as root user without password:
mysqld_safe --skip-grant-tables &
3) Login into MySQL as root user without a password and switch to the “mysql” database:
mysql -u root mysql
Then execute this SQL query to set a new password for the MySQL root user:
update user set Password=PASSWORD('mynewpassword') WHERE User='root';
(Replace “mynewpassword” with the new root password in the above command).
Then logout from the MySQL prompt by typing:
exit
4) Now bring back the running mysql instance into the foreground by typing:
fg
and then press [ctrl] + c to kill the mysql process.
5) Start the mysql server again:
/etc/init.d/mysql start
CentOS Change Timezone
After installing CentOS we sometimes see that the date is not in our desired timezone, instead it defaulted to the PST timezone.
Correcting your timezone is an easy operation, so here is a quick guide to change your CentOS timezone configuration file.
Firstly you’ll need to know your timezone and/or country, a list can be found in /usr/share/zoneinfo/.
The more generic procedure to change the timezone is to create a symlink to file /etc/localtime
ln -sf /usr/share/zoneinfo/Europe/Bucharest /etc/localtime
OR you can copy and replace the current localtime setting
cp /usr/share/zoneinfo/Europe/Bucharest /etc/localtime
To verify that your timezone is changed use the date command:
date
Install Webmin on Ubuntu 14.04
Webmin is an open source, web based system administration tool for Unix/Linux. Using Webmin, you can setup and configure all services such as DNS, DHCP, Apache, NFS, and Samba etc via any modern web browsers. So, you don’t have to remember all commands or edit any configuration files manually.
Install Webmin On Ubuntu 14.04 LTS using official repository
Add the webmin official repository:
Edit file /etc/apt/sources.list
sudo vi /etc/apt/sources.list
Add the following lines:
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
Add the GPG key:
sudo wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc
Update the sources list:
sudo apt-get update
Install webmin using the following command:
sudo apt-get install webmin
Allow the webmin default port “10000” via firewall, if you want to access the webmin console from a remote system.
sudo ufw allow 10000
Access Webmin console
Open up your browser and navigate to the URL https://ip-address:10000/. The following screen should appear. Enter the user name and password to log in to webmin console.
How to combine all .vcf files to single .vcf file using cmd
In general to export your phone contacts/or to import them from one device to another device we use the “VCARD” feature. By using this feature you can back up our phones contacts to vCards (.vcf files) are very important part of our life because we all are using some kind of mobiles, smart phones, PDA devices, iPhones, Tablets plus our online email accounts. In general after Vcard conversion all contacts are converted into individual (vcf) files. If we want import over 200 contacts from Outlook/Exchange/mobile vcard into Google Contacts, with their photos we can convert multiple .vcf files into a single vcf files by using COMMAND prompt.
Steps to Bulk Import (Merge/combine) vCards into One Contact List (single .vcf file).
Step 1. First Copy all your vcf files into one Folder/directory.
Step 2. Open Windows command prompt (Windows + R), then type “CMD” to open command prompt and navigate to the destination folder where all your contact files are stored (you can type CD YOUR PATH command to reach to your destination).
Ex: You have copied your vcf files in folder named “contacts” then in command prompt type in the path of that folder.
Step 3. Enter the following DOS command: copy *.vcf all-contacts.vcf
Step 4. Now you will get all your .vcf files merged into single .vcf file, just Import the created single .vcf file whenever required. This single vCard file will also work on your Google account.
Find out what model the motherboard on my computer is
If you want to find out the exact model of your computer’s motherboard so that you can see what sort of memory chip, graphics cards and other components it supports use the following command:
wmic baseboard get product,Manufacturer,version,serialnumber
You will get you the maker of the motherboard, model number and serial.
Working on Windows 7.
What’s the default superuser username/password for postgres after a new install?
If you just installed postgresql 8.x/9.x and it has never asked you to create a superuser/password here is how to reset the default superuser and its password:
sudo -u postgres psql postgres
# \password postgres
Enter new password:
How to find a particular text string in Linux
You need to use the grep command. The grep command searches the given input FILEs for lines containing a match or a text string.
grep command syntax
The syntax is:
grep "text string to search" directory-path
or
grep [option] "text string to search" directory-path
or
grep -r "text string to search" directory-path
or
grep -r -H "text string to search" directory-path
or
egrep -R "word-1|word-2" directory-path
or
egrep -w -R "word-1|word-2" directory-path