Unable to loginto remotely with password on same line
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.
you are using the wrong approach here. Instead of using a password you should be using public/private key authentication (RSA auth in this case). With this method you do not need to enter a password every time you ssh somewhere.
The web is simply full of information on how to do this. The first hit in the following search is probably all you need to set it up.
I will explore my requirement so that you will have an idea,
We have around 500 local desktop machines and Users are working on it, system restart is mandatory to open few tools , all the time users may miss to restart the machine and escalate to for assistance.
So though to create a script to prompt a window to restart the machine whenever they try to open the tool if the system was not restarted and when the click on ok it should reboot.
users does't have sudo or admin access to reboot from terminal hence wanted to pass my credential through scripts as i have sudo access to reboot the system when they hit the ok button on the window.
Hope this is clear, please advice what should be my next step to achieve this.
I will give this command ssh myusername@localdeskip "sudo reboot" to the user
How would user run this command without my login and sudo credentials even after enabled the password less login as you said earlier?
I am sorry if i am not clear on my concern I tried the passwordless login process but
I will give this command ssh myusername@localdeskip "sudo reboot" to the user How would user run this command without my login and sudo credentials even after enabled the password less login as you said earlier?
They wouldn't. If you trust a user to be able to perform administrator actions (like reboot a server), then you add them to the SUDOER's file too, so that THEY could run the command. Also, if you read the man page on ssh, you can specify which identity file, key, and user name they log in as. Putting your own user ID/password into a script is a TREMENDOUSLY bad idea, especially if you're the administrator.
The better thing to do would be modify the sudoer's file on your machines to allow users to ONLY run the reboot command as root. That way, they could ONLY reboot their machines, and do nothing else, and your password isn't exposed.
TB0ne is correct. Although a password less login won't expose your password, but it also gives full rights to the user. So it'd be better to add those users to sudoers file and allow them only 1 or 2 commands like shutdown and reboot.
Take a note, since you're also using 'sudo' to do admin tasks, so even after a password less login, those users will need your password to do a 'sudo'.