[SOLVED] ssh-keygen always creates root user in comment
Linux - NewbieThis 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!
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.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am new to Linux, currently using Debian plus MongoDB for cloud services and also going into ARM-based embedded applications.
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.
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