LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-07-2015, 11:21 AM   #1
apss_evaluator
Member
 
Registered: Mar 2012
Posts: 115

Rep: Reputation: Disabled
tweak ssh credentials


Hi Linux Guru's

just want to ask if there is a way that I can ssh to target host and the target host will accept the my login but will appear as a different user. Like this:


SOURCE:
[rundeck@host~]ssh rundeck@target


TARGET:
Last login:0705/2015 from rundeck
[user@target ~]
 
Old 07-07-2015, 11:52 AM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,520

Rep: Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106
I don't understand. You want to log in as user1 but have it automatically become user2 once you're logged in? How would that work?

Why don't you just ssh directly to the user you want to be?
 
Old 07-07-2015, 12:13 PM   #3
apss_evaluator
Member
 
Registered: Mar 2012
Posts: 115

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
I don't understand. You want to log in as user1 but have it automatically become user2 once you're logged in? How would that work?

Why don't you just ssh directly to the user you want to be?
Hi I am also aware of that, but there are some restrictions to the target host on adding a user as "rundeck". Just asking i it is possible
 
Old 07-07-2015, 12:50 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,520

Rep: Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106
Is what possible? Please explain your question more clearly, I don't understand what you're asking.
 
Old 07-07-2015, 12:56 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,515

Rep: Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545
What do you want that is not what you get by using
Code:
ssh -l someuser target_host
 
Old 07-07-2015, 01:01 PM   #6
apss_evaluator
Member
 
Registered: Mar 2012
Posts: 115

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
Is what possible? Please explain your question more clearly, I don't understand what you're asking.
Just asking if it is possible, if not I'm still okay with it
 
Old 07-07-2015, 01:06 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,466
Blog Entries: 6

Rep: Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407
What is "it" that you are OK with? I am with suicidal on this, I fully do not understand the question...
 
Old 07-07-2015, 01:19 PM   #8
apss_evaluator
Member
 
Registered: Mar 2012
Posts: 115

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by astrogeek View Post
What is "it" that you are OK with? I am with suicidal on this, I fully do not understand the question...
sorry if my question is confusing, I still got limited english knowledge, I meant to refer if - is that possible?

to have a rundeck user from host1 connect to host2 but will appear as user@host2 after login
 
Old 07-07-2015, 01:25 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,466
Blog Entries: 6

Rep: Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407Reputation: 2407
Quote:
Originally Posted by apss_evaluator View Post
sorry if my question is confusing, I still got limited english knowledge, I meant to refer if - is that possible?

to have a rundeck user from host1 connect to host2 but will appear as user@host2 after login
As asked, the answer is no.

If you need the permissions of user@host after login then you need the login credentials of user@host, so why not just login as user@host in the first place?
 
Old 07-07-2015, 01:25 PM   #10
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,520

Rep: Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106
Quote:
Originally Posted by apss_evaluator View Post
sorry if my question is confusing, I still got limited english knowledge, I meant to refer if - is that possible?

to have a rundeck user from host1 connect to host2 but will appear as user@host2 after login
That doesn't really help.

Answer this - Does host2 have a "rundeck" user? Does host2 have a "user" user? Which user do you have the password for? Which user do you want to access files as?
 
Old 07-07-2015, 01:36 PM   #11
apss_evaluator
Member
 
Registered: Mar 2012
Posts: 115

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
That doesn't really help.

Answer this - Does host2 have a "rundeck" user? Does host2 have a "user" user? Which user do you have the password for? Which user do you want to access files as?
host2 has no rundeck user but has already have "user" user

no specific files needed, lets not stress this out. I think my idea is really impossible :-)

I appreciate for looking on this
 
Old 07-07-2015, 03:01 PM   #12
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,704

Rep: Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270Reputation: 1270
I think (not sure) the OP wants the remote user name...

In which case, maybe something like:

http://superuser.com/questions/16316...that-changes-f

can be used. Normally this is disabled (PermitUserEnvironment is set to no), but can be controlled (see manpage on sshd_config) and dthe "AcceptEnv" option

From the manpage on sshd_config:
Code:
     AcceptEnv
             Specifies what environment variables sent by the client will be
             copied into the session's environ(7).  See SendEnv in
             ssh_config(5) for how to configure the client.  Note that envi
             ronment passing is only supported for protocol 2.  Variables are
             specified by name, which may contain the wildcard characters *
             and ?.  Multiple environment variables may be separated by
             whitespace or spread across multiple AcceptEnv directives.  Be
             warned that some environment variables could be used to bypass
             restricted user environments.  For this reason, care should be
             taken in the use of this directive.  The default is not to accept
             any environment variables.
And the entry in the manpage for ssh_config:
Code:
    SendEnv
             Specifies what variables from the local environ(7) should be sent
             to the server.  Note that environment passing is only supported
             for protocol 2.  The server must also support it, and the server
             must be configured to accept these environment variables.  Refer
             to AcceptEnv in sshd_config(5) for how to configure the server.
             Variables are specified by name, which may contain wildcard char
             acters.  Multiple environment variables may be separated by
             whitespace or spread across multiple SendEnv directives.  The
             default is not to send any environment variables.
Now USING it might be a bit tricky - as trying to pass something like "REMOTE_LOGIN" would mean that the environment variable REMOTE_LOGIN has to be initialized before using the ssh command. This could be done via the .login script type of thing - if "REMOTE_LOGIN" doesn't exist, then set it to "$LOGNAME".

It would have to be initialized ONLY if it doesn't exist - if it does exist, then it was "sent" by ssh.

Last edited by jpollard; 07-07-2015 at 03:12 PM.
 
Old 07-07-2015, 03:10 PM   #13
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,520

Rep: Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106
Quote:
Originally Posted by apss_evaluator View Post
host2 has no rundeck user but has already have "user" user

no specific files needed, lets not stress this out. I think my idea is really impossible :-)

I appreciate for looking on this
As rknichols asked, what are you looking for that isn't already handled by:

ssh user@host2
or
ssh -l user host2

?
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to Tweak And Perfect The Unity Desktop With Unity Tweak Tool Linux/Ubuntu LXer Syndicated Linux News 0 04-04-2013 08:51 PM
How do I copy user credentials from a MySQL table into SSH users Zoner Linux - Newbie 3 03-13-2011 08:25 PM
Kerberos credentials aren't forwarded after SSH 0ddba11 Linux - Software 4 02-18-2010 09:09 AM
SSH using Active Directory credentials fail noir911 Linux - Server 1 09-17-2009 09:35 AM
SSH and credentials file? fruitwerks Linux - Security 3 05-07-2009 03:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:14 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