May 5th, 2009 Category: Linux
People often using Putty, xterm or any other Linux test based console will probably now this annoying issue:
- Changing into a deeper directory structure will create an incredible long bash prompt
For me it was quite annoying to have the prompt sometimes wider than the terminal window. In Debian standard configuration this is the case. So I decided to shorten the prompt.
I kept my prompt very simple, the only thing you have to do is to add the following lines to your ~/.bashrc
export PS1="[\u@\h \W]\\$ "
export PS2="> "
Make sure to add it at the end of your .bashrc file in your home directory. Otherwise it may be overwritten by other prompt definitions in your .bashrc.
Before
harry@h1096660:/usr/local/include/ffmpeg$
After
[harry@h1096660 ffmpeg]$
Better
Further links and examples
Written on May 5, 2009 | Posted in
Linux
February 21st, 2009 Category: General, Linux
Annoyed of typing login passwords?
Your desktop is running with Windows and you often need to connect remote servers using SSH then you will already know PuTTY. You will also know that it’s getting frustrating to enter the passoword every time. There is a simple way to login to remote machines using RSA/DAS keys.
What is needed?
First of all you will need to download the PuTTY.exe. And to generate the keys on your Windows desktop you’ll need to download PuTTYgen.exe as well.
Key Generation
Start PuTTYgen.exe after download and press the Generate button. Now follow the instruction and move the mouse cursor over the desired area. I’ve used the default parameter [x] SSH-2 RSA with a key length of 1024 bits.
I leave the Key passphrase empty because I don’t want to enter any passwords during login.
To have the key later available for other servers use the “Save public key” and “Save private key” button. My private key is saved as haifisch.ppk and my public key as haifisch. By the way, haifisch is German and means shark.
Now mark the generated public key, copy it to the clip board and paste it into ~/.ssh/authorized_keys file on the remote server of the user you want to login as.
PuTTY Configuration
Keys have been generated and stored on the remote server, therefore PuTTYgen can be closed now and the PuTTY.exe is needed now.
In PuTTY under the item “Session” enter the host name of the remote server and connection type SSH. Next choose “Connection/Data” and enter the remote user name. Also the previously defined private key is needed, it is given in “Connection/SSH/Auth” using the “Browse” button. In my case it’s haifisch.ppk.
When all settings are done go back to “Session”, enter a name for this session and press “Save”.
That’s it. Try it by double clicking on the saved session.
Login via Desktop Icon
If you want to have a desktop icon which opens putty and logs into a remote server generate a file e.g. www.myserver.com.bat with the content:
start C:\temp\putty\putty.exe -load "Session Name in PuTTY"
Now generate a link to this batch file on your desktop and login in by double clicking.
Written on February 21, 2009 | Posted in
General,
Linux