LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > 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

Reply
 
Search this Thread
Old 11-04-2009, 11:48 AM   #1
Amckin
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
How to change .bashrc prompt for logging in via SSH.


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.
 
Old 11-04-2009, 12:48 PM   #2
ammorais
Member
 
Registered: Nov 2009
Location: Lisbon, Portugal
Distribution: Gentoo, CentOs, Ubuntu, Debian
Posts: 182

Rep: Reputation: 49
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
 
  


Reply

Tags
bashrc, ssh


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 09:04 AM
[SSH] Issue logging in [SSH & Permissions] MD3 Linux - Networking 11 12-10-2006 09:25 AM
Logging in Error in Fedora 5, /etc/bashrc command not found EmmaTheViking Linux - Newbie 10 05-24-2006 11:59 PM
[SOLVED] Change the prompt during ssh connections. angel115 Linux - Newbie 2 09-26-2005 04:02 AM
Logging in and getting login prompt again dkaplowitz Red Hat 5 11-21-2003 03:43 PM


All times are GMT -5. The time now is 02:57 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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration