Category Archives: Linux

How to change VNC Server password on Linux

To change VNC Password on Linux You can either connect to the machine remotely over an ssh program like putty or you can do this directly from the terminal. Open up a command prompt for the user that you have vnc server running as. Then type vncpasswd You will then be prompted to enter a new password twice. Choose your new vnc server password and then restart the vncserver service using the following command. service vncserver restart The above commands work when run as the root user on Centos but should work similarly on most other variation of Linux....

Ever been Hacked and now you can’t delete the file…Operation not permitted

You can check the file and ownership permissions as well as if the file is set to immutable with these commands in root SSH: ls -lah /home/username/public_html/pathtofile lsattr /home/username/public_html/pathtofile The first command will show the file and ownership permissions. If they are 000 or root:root, the root user should still be able to remove the file regardless with this command: cd /home/username/public_html/pathtofolder rm filename People can really get into trouble by running rm commands without ensuring they are at the correct directory path for the removal. Next, the "lsattr" command above, the second one, will show if there are any attributes set on the file. If you see a -i on the lsattr command, then run this command to unset that attribute: chattr -i /home/username/public_html/pathtofile This will remove that immutable file attribute. What immutable does would be preventing changing and removing a file. If...

Killing zombie process

Zombie process is an inactive computer process, according to wikipedia article, "...On Unix operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process table, allowing the process that started it to read its exit status. In the term's colorful metaphor, the child process has died but has not yet been reaped..." So how do I find out zombie process? Use top or ps command: # top OR # ps aux | awk '{ print $8 " " $2 }' | grep -w Z Output: Z 4104 Z 5320 Z 2945 How do I kill zombie process? You cannot kill zombies, as they are already dead. But if you have too many zombies then kill parent process or restart service. You can kill zombie process using PID obtained from any one of the above command....

Find and Change File Permissions Recursively, Linux / UNIX

To find all files in /home/user/demo directory, enter: $ find /home/user/demo -type f -print To find all files in /home/user/demo directory with permission 777, enter: $ find /home/user/demo -type f -perm 777 -print Finally, apply new permission using the -exec option as follows: $ find /home/user/demo -type f -perm 777 -print -exec chmod 755 {} \; To select directories and subdirectories use the following syntax: $ find /home/user/demo -type d -perm 777 -print -exec chmod 755 {} \;...

extract .xz format Linux

If the file is just something.xz (without .tar) then use
unxz something.xz
Otherwise use
*.tar.bz2)	tar xvjf filename.tar.bz2) ;;
*.tar.gz)	tar xvzf filename.tar.gz) ;;
*.tar.xz)	tar Jxvf filename.tar.xz) ;;
*.bz2)		bunzip2 filename.bz2) ;;
*.rar)		unrar filename.rar) ;;
*.gz)		gunzip filename.gz) ;;
*.tar)		tar xvf filename.tar) ;;
*.tbz2)		tar xvjf filename.tbz2) ;;
*.tgz)		tar xvzf filename.tgz) ;;
*.zip)		unzip filename.zip) ;;
*.Z)		uncompress filename.Z) ;;
*.7z)		7z filename.7z) ;;
 ...

Change MySQL root Password

Change MySQL root Password

Method #1: Use mysqladmin command to change root password

If you have never set a root password for MySQL server, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows: $ mysqladmin -u root password NEWPASSWORD However, if you want to change (or update) a root password, then you need to use the following command: $ mysqladmin -u root -p'oldpassword' password newpass For example, If the old password is abc, you can set the new password to 123456, enter:
$ mysqladmin -u root -p'abc' password '123456'

Method #2: Changing MySQL root user password using mysql command

This is an another method. MySQL stores username and passwords in user table inside MySQL database. You can directly update or change the password using the...