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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-22-2012, 03:42 AM
|
#1
|
LQ Newbie
Registered: Oct 2012
Location: Vienna Austria
Distribution: DEBIAN, freescale BSP
Posts: 6
Rep: 
|
ssh-keygen always creates root user in comment
Hi,
I am new to Linux, currently using Debian plus MongoDB for cloud services and also going into ARM-based embedded applications.
My problem:
A shell script running under root uses ssh-keygen to create ssh keys.
Just before the keygen, su command is used to switch over to the tunnel-user.
I expected the comment within the public rsa key to be tunnel-user, but instead it is root@host.
As a workaround I tried to specify the comment explicitly with -c and -C but without success.
When giving the 'su tunnel-user command' interactively, I found that the prompt remains at root@host, but the command does not give an error, which I consider strange.
So in fact I have 2 questions:
- what can be the reason that the change of user (per su) is not shown in the prompt? (I experimented with .bashrc and .profile, but no success)
- where does ssh-keygen take its user information for he comment from? (could not find this in the documentation)
Note, why this is important: We have db clusters with a number of servers and tunnel users, so correctly commenting the keys from the beginning would be helpful and avoid admin errors later when the keys are copied into authorized_keys.
Thanks for all insights!
|
|
|
10-22-2012, 06:08 AM
|
#2
|
Member
Registered: Oct 2012
Location: Germany
Distribution: Ubuntu, Debian, Fedora,Windows 7
Posts: 107
Rep:
|
You can check /var/log/messages file for any possible problem. Als you may try to run su with a space and -,like su - , which causes the environment variable to be changed also.
Have you tried using sudo? You may try:
sudo -u user command
Thanks!
|
|
1 members found this post helpful.
|
10-24-2012, 10:46 AM
|
#3
|
LQ Newbie
Registered: Oct 2012
Location: Vienna Austria
Distribution: DEBIAN, freescale BSP
Posts: 6
Original Poster
Rep: 
|
partial solution
Thanks for the hints!
I found out why su did not work: Since the user was created per script as system user, it had :bin/false in its passwd entry, which disables shell response.
As workaround for debugging use the -s option to enable shell interaction: su - user -s /bin/sh
|
|
|
10-24-2012, 11:25 AM
|
#4
|
LQ Newbie
Registered: Oct 2012
Location: Vienna Austria
Distribution: DEBIAN, freescale BSP
Posts: 6
Original Poster
Rep: 
|
Solved!
Since user switching now works properly with -s option above, ssh_keygen generates the correct comment!
Mystery solved, thanks!
|
|
|
All times are GMT -5. The time now is 10:17 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|