Sunday, July 7, 2013

Remove path from prompt in ubuntu

Most of the times in linux machine, you will get a prompt which shows complete path of present working directory i.e pwd. It looks like as -"/home/akash/dir1/movies/hindi/latest$"
But I want to see only "$" prompt on my terminal.
How to achieve this?
Ans: Simple, just export following variable or add it to .bashrc file
export PS1="\u $ "

Tuesday, April 16, 2013

Automounting error on Ubuntu:

 When you have dual boot machine, say windows and ubuntu. If you are currently running windows and hibernated it. Now, your machine is off and you decided to boot ubuntu. When ubuntu is started, now if you try to mount the windows drives, it will pop out error similar to the one mentioned below-
 
Mounting exited with exit code 14:windows is hibernated, refused to mount. Failed to mount '/dev/sde2':Operation not permitted. The NTFS partition is hibernated. Please resume and shutdown windows properly or mount the volume read-only with the 'ro' mount option, or mount the volume read-write with the 'remove_hiberfile' mount option. For example type in command line:  

Solution: Run the command similar to the one written below-
$ sudo mount -t ntfs-3g -o remove_hiberfile  /dev/sda1   /media/akash

where, /dev/sda1 is windows partition

Thursday, February 28, 2013

SSH without password

SSH to server/client without entering ssh password:

I would like to thank my friend, guide Mr. Rajendra to help me.

Suppose there are two Linux machines. In my case both were ubuntu machines say buntu1 and buntu2

On buntu1  machine-
# ssh-keygen -t rsa
# cat ~/.ssh/id_rsa.pub | ssh  user_buntu2@buntu2 'cat >> ~/.ssh/authorized_keys'

Here it will ask the password once to open ssh to buntu2. 

On buntu2  machine-
# ssh-keygen -t rsa
# cat ~/.ssh/id_rsa.pub | ssh  user_buntu1@buntu1 'cat >> ~/.ssh/authorized_keys'

Here it will ask the password once to open ssh to buntu1. 

From now on, ssh will never ask for password.