Search!

Stuff

Powered by Pivot - 1.40.6: 'Dreadwind'
XML: RSS Feed
XML: Atom Feed

Linkdump

» Example linkdump..

Category "linkdump" is currently empty.

  No comments |

Why the colorful prompt is good for CentOS

Monday 20 October 2008 at 03:56 am

It is rather an old trick - adding a color to your prompt.  But it was resurrected when someone asked a question on a CentOS forum:

"how can I change color of root@localhost inside console????"

After some cheerful exchange, it turned out that this person wanted to know how to color the root's prompt.  As usual, a nice team work of regular helpers (especially between Alan and Ned) brought about colorful answers.

In fact, making the root's prompt a colorful one is indeed a good idea.  It reminds you of the root status in a much nicer way than the usual # prompt.  I put in my root's ~/.bashrc the following:

export PS1="\[\e[31;1m\][\u@\[\e[34;1m\]\H \W]# \[\e[0m\]"

This gives me  [root@apollo ~]# which, in a way, has some American touch.  Hmmm.

This is all good for bash.  However, my own acount uses (t)csh.  Not to worry.  csh supports colors, too.  For example, putting this line in the .login file (one line):

set prompt =
 "\[%{\033[32m%}%n@%{\033[34m%}`echo $cwd`%{\033[0m%}\]$ "

produces  [toracat@/home/toracat]$

I also have an alias for "cd" (one line):

alias cd 'cd \!* ; set prompt = 
 "\[%{\033[32m%}%n@%{\033[34m%}`echo $cwd`%{\033[0m%}\]$ "'

to get a consistent look (csh again).

Why is this good for CentOS?  You can see it in the original CentOS thread:

The person who asked the question was so happy with the help he received that he decided to make a donation to CentOS.  What really helped here was the "please donate" message in the Ned's signature.  :-)  Prompted by this, I have added a link to the donation page in my signature.

Socks proxy with auto-config

Tuesday 30 September 2008 at 04:35 am

OpenSSH has built-in support to act as a SOCKS proxy. In my case, there are web sites I can access only from work computers and I need to get to them from home. So, I issue the command from my home computer:

 ssh -D 1080 <my work IP>

However, I do not want to redirect all traffic through work.  Fortunately, you can redirect only selected URLs fairly easily by using a proxy auto-config file.

In firefox, Go to Edit -> Preferences -> Advanced -> Network -> Settings

In the Connection Settings box, select "Automatic proxy configuration URL:" and enter: file:///path/to/proxylist.pac The proxylist.pac file may look like this:

function FindProxyForURL(url, host)
{
// Proxy direct connections to these hosts
if (
shExpMatch(url, "http://www.jbc.com/*") ||
shExpMatch(url, "*.sgmjournals.org/*") ||
shExpMatch(url, "http://www.ncbi.nih.gov/*")
) {
return "SOCKS localhost:1080; DIRECT";
}
// Otherwise go directly
else return "DIRECT";
}
For more details on the pac file and auto config, see http://en.wikipedia.org/wiki/Proxy_auto-config

sshfs - Remote filesystem access made easy

Sunday 21 September 2008 at 11:43 pm

If you often need to access files on a remote machine and do it by ssh login, there is a handy way - sshfs.  Here is a simplified howto that works on CentOS.

(1) Set up the rpmforge repository if not done yet (see  Installing RPMForge on CentOS )

(2) Either use the dkms-fuse with the stock CentOS kernel or use the centosplus kernel that contains the fuse kernel module.

  [root@mybox ~]# yum install dkms-fuse && modprobe fuse

(3)  Also install the fuse libraries:

  [root@mybox ~]# yum install fuse

(4)  Then install the fuse-ssh filesystem:

  [root@mybox ~]# yum install fuse-sshfs

(5)  Add yourself to the group 'fuse':

  [root@mybox ~]# usermod -a -G fuse user1

(6)  Re-logon to your account

(7)   Create a local directory:
  [user1@mybox ~]$ mkdir remotedir/
(8)  To mount (remote username=usr2):
  [user1@mybox ~]$ sshfs user2@machine.example.com: remotedir/

(9)  To unmount:

  [user1@mybox ~]$ fusermount -u remotedir

Blog? What's that?

Saturday 23 August 2008 at 11:39 pm We are now in the 21st century.  And because we are all supposed to have a blog... Here it is. This is mine.  You can see it, hear it and even read it.
 

About

The photo in the header was taken in the Anza Borrego Desert State Park near San Diego, California.

Tag cloud

Archives

01 Sep - 30 Sep 2007
01 Aug - 31 Aug 2008
01 Sep - 30 Sep 2008
01 Oct - 31 Oct 2008

Last Comments

Links

CentOS Home
CentOS Wiki
Planet CentOS
CentOS Forums

Pivot Homepage
Pivot Forums
Pivotstyles
Pivot Help