SSH automatically login with su


Recommended Posts

i think you need to explically activate the su account on ubuntu user-acccount settings. this however is absolutely NOT recommanded and underminse the security concept of linux.

Link to comment
Share on other sites

I dont understand why you would want to

 

This would be the same as logging in as root which goes against the whole point of having admin and user accounts

 

you can just do

ssh user@server

and then

sudo command
Link to comment
Share on other sites

i think you need to explically activate the su account on ubuntu user-acccount settings. this however is absolutely NOT recommanded and underminse the security concept of linux.

I added the account to the sudoers file, how do I activate it via command line?

Link to comment
Share on other sites

or write 2 bash files executing sudo first then the program...

Link to comment
Share on other sites

Under Ubuntu you'd activate the "root" account, which you can do just by giving it a password ("sudo passwd").. but as Haggis recommended, it's not the best idea. (Just another attack surface, sudo will log everything done, etc) You can also use visudo to fine-tune permissions, etc if needed.

Link to comment
Share on other sites

I added the account to the sudoers file, how do I activate it via command line?

 

so lets say your user is haggis and you added haggis to sudoers file on the server your are SSHing into

ssh haggis@server

then once logged in do

sudo cp /etc/fstab ~/fstab.txt

etc

Link to comment
Share on other sites

I'll provide some more information.

 

This is for a web server.

For my old web server (which someone else setup for me) I was given an account. When I login with putty, I just use the IP and port and in the terminal I have user@server:~$:

This allows me to hit tab and it will autocomplete with a dir or file etc

 

On my new webserver which I setup myself, I made an account, added it to the sudoers file, but when I login, the same way, which just an IP and port I only have the following in the terminal

$

And I can't use tab. How do I make it user@server:~$   ? So far, doing su user is the only way

Link to comment
Share on other sites

On my new webserver which I setup myself, I made an account, added it to the sudoers file, but when I login, the same way, which just an IP and port I only have the following in the terminal

$

And I can't use tab. How do I make it user@server:~$ ? So far, doing su user is the only way

Sounds like you need to copy over a .bashrc file into that users home directory. That sets up tab completion, the default prompt, all that jazz. Don't need to log in as root for that.
Link to comment
Share on other sites

Sounds like you need to copy over a .bashrc file into that users home directory. That sets up tab completion, the default prompt, all that jazz. Don't need to log in as root for that.

Ah good to know! Thanks :)

Link to comment
Share on other sites

I'll provide some more information.

 

This is for a web server.

For my old web server (which someone else setup for me) I was given an account. When I login with putty, I just use the IP and port and in the terminal I have user@server:~$:

This allows me to hit tab and it will autocomplete with a dir or file etc

 

On my new webserver which I setup myself, I made an account, added it to the sudoers file, but when I login, the same way, which just an IP and port I only have the following in the terminal

$

And I can't use tab. How do I make it user@server:~$   ? So far, doing su user is the only way

 

why su user not sudo user? sudo allows using tab for autocomplete....

write a bash file:

sudo yourcommand, save it as .sh make it executable and put it in your autostart list...

Link to comment
Share on other sites

why su user not sudo user? sudo allows using tab for autocomplete....

write a bash file:

sudo yourcommand, save it as .sh make it executable and put it in your autostart list...

I'm not this familiar with linux, but I will look into it

Link to comment
Share on other sites

I'm not this familiar with linux, but I will look into it

sudo yourprogram

save this as ./run123.sh

chmod it to +777 and just add an autostart entry (if you got a KDE based distro i can give you screenshots where to find it).

with kde it's easy, as you can either use sudo, kdesudo or gksudo to run that sh file.

Link to comment
Share on other sites

I think I solved it. I went into the passwd file and added /bin/bash to my user. :D Now I have what I was trying to accomplish :D

gotta love when it's just something simple that was overlooked :)

Link to comment
Share on other sites

Set marked as solved for .

 

https://www.neowin.net/forum/topic/1228487-ssh-automatically-login-with-su/?view=findpost&p=596567405

 

 

I think I solved it. I went into the passwd file and added /bin/bash to my user. :D Now I have what I was trying to accomplish :D

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.