allowing ssh connection without password as user how do I do it...?
SlackwareThis Forum is for the discussion of Slackware Linux.
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.
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.
I have an aplication that needs to connect to X through ssh...
My host can be pinged allright :
bash-3.1$ ping iskandhar
PING iskandhar.site (192.168.100.10) 56(84) bytes of data.
64 bytes from iskandhar.site (192.168.100.10): icmp_seq=1 ttl=64 time=0.031 ms
64 bytes from iskandhar.site (192.168.100.10): icmp_seq=2 ttl=64 time=0.028 ms
64 bytes from iskandhar.site (192.168.100.10): icmp_seq=3 ttl=64 time=0.027 ms
64 bytes from iskandhar.site (192.168.100.10): icmp_seq=4 ttl=64 time=0.027 ms
^C
--- iskandhar.site ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.027/0.028/0.031/0.004 ms
bash-3.1$
But when i try to access iskandhar through ssh it asks for a password, which i defined as empty when creating ssh ids... :
bash-3.1$ ssh iskandhar
The authenticity of host 'iskandhar (192.168.100.10)' can't be established.
RSA key fingerprint is 36:5a:02:5f:d4:29:81:f8:50:79:79:98:b1:0e:e1:e1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'iskandhar,192.168.100.10' (RSA) to the list of known hosts.
alex@iskandhar's password:
Permission denied, please try again.
alex@iskandhar's password:
Permission denied, please try again.
alex@iskandhar's password:
Permission denied (publickey,password,keyboard-interactive).
bash-3.1$
How do I disable password checking when connecting to X through ssh...?
BRGDS
Alex
Click here to see the post LQ members have rated as the most helpful post in this thread.
I changed the allowEmptyPassword thing in sshd_config, and had to change the r/w permissions in the ~/.ssh folder...
Works ok now... :
bash-3.1$ ssh localhost
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
Last login: Sun Nov 15 20:46:51 2009 from localhost
Linux 2.6.29.6.
C, n.:
A programming language that is sort of like Pascal except more
like assembly except that it isn't very much like either one, or
anything else. It is either the best language available to the art
today, or it isn't.
-- Ray Simard
It would be much safer to use a pub/priv key for password-less authentication. you can generate a key pair on the client using ssh-keygen and then add the public key to ~/.ssh/authorized_keys on the server.
I believe password-less logins work best with keys. With a user's public key available in authorized_keys, then that user should be able to login without a password. This is not the same as using empty passwords. The public/private key combo functions like using passwords but is more secure.
Here is my sshd_config:
Code:
Protocol 2
SyslogFacility LOCAL6
LoginGraceTime 30s
PasswordAuthentication no
AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
PrintMotd no
PrintLastLog no
Subsystem sftp /usr/libexec/sftp-server
Some people will scream with the following advice, but you can enable root logins without using a password. You decide if that is what you want. You need root's public key in authorized_keys. Then in sshd_config add:
Code:
PermitRootLogin without-password
To use X apps through ssh, you'll need at least the following in ssh_config:
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
Something you may want to consider is not editing /etc/ssh/sshd_config (which is system-wide) in favor of editing individual user accounts. The way you do this is to add ~/.ssh/config and that file contains the directives you want for that specific user to access specific other machines both on your intranet and external machines as well.
I have three machines on my intranet, fubar, snafu and pita; I also access external machines and permit one of them access to my machines ('cause it's a Sun workstation that I use at work -- that machine is not shown below, but its configuration is identical to the others). My ~/.ssh/config files all look like this one (which resides on pita:
Code:
Host fubar
ForwardAgent yes
ForwardX11 yes
Compression yes
Protocol 2,1
User trona
Host fubar
ForwardX11 yes
Compression yes
Protocol 2,1
User root
Host snafu
ForwardAgent yes
ForwardX11 yes
Compression yes
Protocol 2,1
User trona
Host snafu
ForwardX11 yes
Compression yes
Protocol 2,1
User root
Host *
ForwardX11 no
What this gives you is control (over individual users; e.g., your kids can't go fooling around in places you don't want them experimenting -- and that goes for all other users too) and, when there is an update you don't have to go fooling around reediting /etc/ssh/sshd_config either.
The above counts on the ~/.ssh/known_hosts and ~/.ssh/authorized_keys (containing the public keys for each user account on the external servers) as described in previous posts. When I generate keys I do not use a pass phrase (I just hate typing passwords all the time) knowing that I'm going to copy the public key to other machines' and knowing that SSHs public-private key mechanism works just fine. Then it's a simple matter of typing ssh fubar and getting connected either locally or remotely.
...To use X apps through ssh, you'll need at least the following in ssh_config:
Hi Woodsman,
It helps allright, but I guess I also have to disable the noListen TCP option thing, only I do not know how it is done, I mean, i've searched man xinit, and man x, and there is no clue as what is the allowed syntax, and where in .xinitrc must I drop that command... is it noListenTCP=0...?
I know that if one uses a DE, one sets this in XDM, KDM, or GDM ( Like I set it in Lenny/Gnome ) , but I am only using a WM.... I boot directly into startx to fluxBox...
It helps allright, but I guess I also have to disable the noListen TCP option thing, only I do not know how it is done, I mean, i've searched man xinit, and man x, and there is no clue as what is the allowed syntax, and where in .xinitrc must I drop that command... is it noListenTCP=0...?
I modify my startx script:
serverargs="-dpi 120 -ac -nolisten tcp"
Look here for an example. The startx file is linked at the bottom.
-nolisten tcp has nothing to do with ssh and X11Forwarding.
Ok, but AFAIK -nolisten tcp is enabled by default in Slackware... ( and in many other Distros BTW ) An it stops an Appliaction that I have from creating an XTerm window displaying a runtime process...
How do I disable it...?
Should be enough to modify the
serverargs="-dpi 120 -ac -nolisten tcp" to serverargs="-dpi 120 -ac", right ?
( I ask this bcause I am not w/ my slackware box right now...)
serverargs="-dpi 120 -ac -nolisten tcp" to serverargs="-dpi 120 -ac", right ?
Yes, you can modify the arguments --- if you want 120 dots per inch and want to allow listening to TCP.
Know that these arguments can be passed at the command line or embedded in an alias for startx. The parameters do not affect the graphical login manager such as KDM. For run level 4 you have to add the same options to the kdmrc config file.
Ok, but AFAIK -nolisten tcp is enabled by default in Slackware... ( and in many other Distros BTW ) An it stops an Appliaction that I have from creating an XTerm window displaying a runtime process...
Alex
The "-nolisten tcp" will just stop the X server from listening on it's normal TCP/6000. (Generally a good idea and why it is the default)
This TCP port is only needed when connecting directly to the X server from another machine.
To do this you need to allow access via "xhost" and set the "$DISPLAY" variable correctly.
As I said this has nothing to do with X11Forwarding and ssh.
ssh sets the DISPLAY variable automatically and tunnels X through an encrypted channel. The X TCP port is not used nor is xhost etc...
(The ForwardAgent is also not actually required (I'll explain this later).
If you have the correct ssh keys set up and "ForwardX11" is "yes" in the server (target machine) sshd_config it should be easy to test with.
Code:
ssh -Y user@somehost some_program_to_run
For example
Code:
ssh -Y mrgoblin@groupy rxvt
will start a remote rxvt but display it on my local X session.
(you can skip the -Y if you set "ForwardX11Trusted" for that host in your .ssh/config file)
Now I can hear the screaming already but the pass-phrase-less keys are not the most secure approach and not needed either. If anyone gets a copy of your private key then they have unfettered access to any machine that has your public key installed.
You should be creating keys with a pass-phrase and taking advantage of ssh-agent to remember said phrase.
You can check if ssh-agent is already running by looking for the SSH_AGENT_PID and SSH_AUTH_SOCK variables.
Code:
env |fgrep SSH
should show them.
If they are there then skip the next step.
If there is no sign of ssh-agent running then do this.
Code:
eval $(exec ssh-agent)
you should now see those variables.
now simply load your private key
Code:
ssh-add ~/.ssh/id_dsa
which should prompt you for your pass-phrase.
Now you can ssh to those hosts without being asked for the pass-phrase each time.
The "ForwardAgent" refers to the forwarding of the ssh-agent credentials allowing you to carry them with you as you hop from host to host.
If you have your keys loaded into ssh-agent there is also a simple way to send your public key to another host.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.