LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-09-2014, 11:21 AM   #1
Jlove130
LQ Newbie
 
Registered: Apr 2008
Distribution: Fedora
Posts: 24

Rep: Reputation: 0
.bashrc alias echo login string to terminal. How to turn off?


I use a ton of alias commands in my .bashrc file for remote desktop links to windows servers. The problem is that many times the command, including username/password is echoed back to the terminal window. Is it possible to suppress any echo? I don't want a casual observer reading my password from a terminal session.

Sample Alias command:
alias webdev='rdesktop -g 1540x1000 -0 -r clipboard -a 24 -x l -d DOMAIN -u USER -p PASSWORD webdev &'
 
Old 01-09-2014, 12:19 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,349
Blog Entries: 36

Rep: Reputation: Disabled
my rdesktop aliases do not show the actual command:

C:\home\jj>amndb1
WARNING: Remote desktop does not support colour depth 24; falling back to 16
C:\home\jj>

alias is
Code:
alias amndb1='rdesktop IP -u <user> -p <password -r clipboard:PRIMARYCLIPBOARD -g 80\%'
GNU bash, version 4.2.37
 
Old 01-09-2014, 12:33 PM   #3
Jlove130
LQ Newbie
 
Registered: Apr 2008
Distribution: Fedora
Posts: 24

Original Poster
Rep: Reputation: 0
It doesn't echo when I execute it, but later

It doesn't echo when I execute the alias, but later. I'll paste some output of my command prompt where its echoed the login info.


Quote:
Originally Posted by Habitual View Post
my rdesktop aliases do not show the actual command:

C:\home\jj>amndb1
WARNING: Remote desktop does not support colour depth 24; falling back to 16
C:\home\jj>

alias is
Code:
alias amndb1='rdesktop IP -u <user> -p <password -r clipboard:PRIMARYCLIPBOARD -g 80\%'
GNU bash, version 4.2.37
 
Old 01-09-2014, 12:37 PM   #4
Jlove130
LQ Newbie
 
Registered: Apr 2008
Distribution: Fedora
Posts: 24

Original Poster
Rep: Reputation: 0
Terminal output where it was echoed

Here's what I see as an example of what I'm saying.. the alias I originally used is "windows" which launches a win8 remote desktop for Outlook use. But you'll see that it echo's the alias login string from previous server logins via alias rdesktop that have closed already:

[john@puddy ~]$ windows
[2] 5082
Autoselected keyboard map en-us
[john@puddy ~]$ Connection established using SSL.
ifdcitops01
[3] 5097
Autoselected keyboard map en-us
[john@puddy ~]$ Connection established using SSL.
WARNING: Remote desktop does not support colour depth 24; falling back to 16
ERROR: RDPSND: Extra RDPSND_NEGOTIATE in the middle of a session
ERROR: RDPSND: Extra RDPSND_NEGOTIATE in the middle of a session
ERROR: RDPSND: Extra RDPSND_NEGOTIATE in the middle of a session

[1] Done rdesktop -g 1440x1000 -x b -0 -r clipboard -a 24 -x l -u <user> -p <password> 172.21.0.57
[3]+ Done rdesktop -g 1440x1000 -0 -r clipboard -a 24 -x l -d <domain> -u <user> -p <password> ifdcitops01
[john@puddy ~]$
 
Old 01-09-2014, 12:50 PM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,349
Blog Entries: 36

Rep: Reputation: Disabled
Don't use "&" at the end of the alias.
 
Old 01-09-2014, 12:57 PM   #6
Jlove130
LQ Newbie
 
Registered: Apr 2008
Distribution: Fedora
Posts: 24

Original Poster
Rep: Reputation: 0
But then terminal session can't to anything else until I logout of RDP

That may work, but then I'd have to have a separate terminal session for each remote desktop session I have running at any given time. Sometimes I have several open for extended periods. It is a thought however... I may try to see if the echo issue is resolved by not using the &.

Quote:
Originally Posted by Habitual View Post
Don't use "&" at the end of the alias.
 
Old 01-09-2014, 01:09 PM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,349
Blog Entries: 36

Rep: Reputation: Disabled
Quote:
Originally Posted by Jlove130 View Post
...I'd have to have a separate terminal session for each remote desktop session...
Not true.
I have one terminal open all day long and I start dozens of rdesktop sessions using a single terminal.
 
Old 01-09-2014, 01:18 PM   #8
Jlove130
LQ Newbie
 
Registered: Apr 2008
Distribution: Fedora
Posts: 24

Original Poster
Rep: Reputation: 0
but doesnt the & set it as a background process?

if I remove the & then the terminal won't accept input until the process of opening the rdesktop ends. How is it that you can do it? Am I missing something (very possibly).

Quote:
Originally Posted by Habitual View Post
Not true.
I have one terminal open all day long and I start dozens of rdesktop sessions using a single terminal.
 
Old 01-09-2014, 02:04 PM   #9
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,349
Blog Entries: 36

Rep: Reputation: Disabled
Quote:
Originally Posted by Jlove130 View Post
if I remove the & then the terminal won't accept input until the process of opening the rdesktop ends. How is it that you can do it? Am I missing something (very possibly).
I mis-spoke.
my terminal is tied up until the rdesktop process ends.

Sorry about that.

Another option is desktop launchers... or my personal preference is use a split terminal (like terminator!)
I actually can have 2 "shells" open at the same time.
or 5 shells all within the terminator program. (2.png)

It's is GREAT for mult-tasking sysadmins everywhere.

Last edited by Habitual; 06-26-2015 at 06:47 PM.
 
1 members found this post helpful.
Old 01-09-2014, 02:53 PM   #10
Jlove130
LQ Newbie
 
Registered: Apr 2008
Distribution: Fedora
Posts: 24

Original Poster
Rep: Reputation: 0
This is great... I'll try it.

This is great... now I can remove the &


Quote:
Originally Posted by Habitual View Post
I mis-spoke.
my terminal is tied up until the rdesktop process ends.

Sorry about that.

Another option is desktop launchers... or my personal preference is use a split terminal (like terminator!)
I actually can have 2 "shells" open at the same time.
or 5 shells all within the terminator program. (2.png)

It's is GREAT for mult-tasking sysadmins everywhere.
 
Old 01-09-2014, 03:05 PM   #11
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,349
Blog Entries: 36

Rep: Reputation: Disabled
Quote:
Originally Posted by Jlove130 View Post
This is great... now I can remove the &
Glad you like it.

I should do a blog post on how to customize a layout for new users of terminator.
Placement, number of "windows", etc... it's quite easy to do!
 
Old 01-09-2014, 04:15 PM   #12
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,569

Rep: Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130Reputation: 2130
Isn't having the command echo to the terminal when you close rdesktop the least of your worries?

Hint: open your rdesktop with the alias, then open another terminal and run:
Code:
ps -ef | grep rdesktop
When you stick your password on the command line like that, anybody who is logged into the machine can read it whenever they like while your rdesktop command is running.

That's why you don't pass sensitive passwords to programs as regular arguments in the call.

It's even mentioned in the rdesktop man page:
Quote:
-p <password>
The password to authenticate with. Note that this may have no
effect if "Always prompt for password" is enabled on the server.
WARNING: if you specify a password on the command line it may be
visible to other users when they use tools like ps.
Use -p - to
make rdesktop request a password at startup (from standard
input).

Last edited by suicidaleggroll; 01-09-2014 at 04:21 PM.
 
Old 01-09-2014, 04:24 PM   #13
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,349
Blog Entries: 36

Rep: Reputation: Disabled
Great point.

He did say however
Quote:
Originally Posted by Jlove130 View Post
I don't want a casual observer reading my password
 
Old 01-14-2014, 10:24 AM   #14
Jlove130
LQ Newbie
 
Registered: Apr 2008
Distribution: Fedora
Posts: 24

Original Poster
Rep: Reputation: 0
I wasn't aware of this... good point.

I am the only one ever logged into my laptop though. I do get that someone could hack it, but it's not exposed to the internet for inbound connections and I doubt anyone in the building can hack a Linux machine. All the other IT staff use Windows and are casual Linux users. I'm not horribly concerned with this issue, but it IS GOOD TO KNOW.

Thank you suicidaleggroll!


Quote:
Originally Posted by suicidaleggroll View Post
Isn't having the command echo to the terminal when you close rdesktop the least of your worries?

Hint: open your rdesktop with the alias, then open another terminal and run:
Code:
ps -ef | grep rdesktop
When you stick your password on the command line like that, anybody who is logged into the machine can read it whenever they like while your rdesktop command is running.

That's why you don't pass sensitive passwords to programs as regular arguments in the call.

It's even mentioned in the rdesktop man page:
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
using 'watch' on an alias in .bashrc slackist Linux - General 11 01-29-2016 02:09 PM
[SOLVED] echo function in .bashrc supulton Linux - Newbie 3 02-25-2010 10:34 PM
using alias's and editing the bashrc cynicalpsycho Linux - Newbie 11 05-07-2009 01:41 AM
alias and .bashrc whaase Linux - General 3 11-02-2003 08:03 PM
alias and bashrc Haldir Linux - Newbie 3 06-14-2002 06:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:50 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration