LinuxQuestions.org
Social Bookmarking all things Linux and Open Source
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices

Tags used in this thread
Popular LQ Tags , ,

Reply
 
Thread Tools
Old 11-04-2009, 12:48 PM   #1
Amckin
LQ Newbie
 
Registered: Oct 2009
Posts: 2
Thanked: 0
How to change .bashrc prompt for logging in via SSH.


[Log in to get rid of this advertisement]
How do I change the .bashrc file to look different when using ssh to access my machine but stay the same for local logins? Thanks in advance.
linuxubuntu Amckin is offline     Reply With Quote
Old 11-04-2009, 01:48 PM   #2
ammorais
Member
 
Registered: Nov 2009
Location: Lisbon, Portugal
Distribution: Gentoo, CentOs, Ubuntu
Posts: 95
Thanked: 16
When login by ssh the $SSH_TTY variable is set.

Code:
if [ ! -n "$SSH_TTY" ]; then
  export PS1="\[\e[32;1m\][\u@\[\e[34;1m\]\H \W]# \[\e[0m\]"  # Local login
else
  export PS1="ssh-\[\e[32;1m\][\u@\[\e[34;1m\]\H \W]# \[\e[0m\]" # Ssh Login
fi
linux ammorais is offline  
Tag This Post , ,
Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.bashrc - how do I remove the working-directory from my prompt? oskar Linux - General 3 02-24-2007 10:04 AM
[SSH] Issue logging in [SSH & Permissions] MD3 Linux - Networking 11 12-10-2006 10:25 AM
Logging in Error in Fedora 5, /etc/bashrc command not found EmmaTheViking Linux - Newbie 10 05-25-2006 12:59 AM
Change the prompt during ssh connections. angel115 Linux - Newbie 2 09-26-2005 05:02 AM
Logging in and getting login prompt again dkaplowitz Red Hat 5 11-21-2003 04:43 PM


All times are GMT -5. The time now is 07:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration