Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #165983 > unrolled thread
| Started by | Tom Browder <tom.browder@gmail.com> |
|---|---|
| First post | 2016-03-26 18:10 +0100 |
| Last post | 2016-03-27 00:40 +0100 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.debian.user
Re: New Deb 8 and no sshd access from other hosts [SOLVED] Tom Browder <tom.browder@gmail.com> - 2016-03-26 18:10 +0100
Re: New Deb 8 and no sshd access from other hosts David Wright <deblis@lionunicorn.co.uk> - 2016-03-26 20:00 +0100
Re: New Deb 8 and no sshd access from other hosts Tom Browder <tom.browder@gmail.com> - 2016-03-30 14:10 +0200
Re: New Deb 8 and no sshd access from other hosts David Wright <deblis@lionunicorn.co.uk> - 2016-03-30 22:10 +0200
Re: New Deb 8 and no sshd access from other hosts [SOLVED] Andrew McGlashan <andrew.mcglashan@affinityvision.com.au> - 2016-03-26 22:20 +0100
Re: New Deb 8 and no sshd access from other hosts [SOLVED] Tom Browder <tom.browder@gmail.com> - 2016-03-27 00:10 +0100
Re: New Deb 8 and no sshd access from other hosts [SOLVED] Andrew McGlashan <andrew.mcglashan@affinityvision.com.au> - 2016-03-27 00:40 +0100
| From | Tom Browder <tom.browder@gmail.com> |
|---|---|
| Date | 2016-03-26 18:10 +0100 |
| Subject | Re: New Deb 8 and no sshd access from other hosts [SOLVED] |
| Message-ID | <rgZSO-3Ms-11@gated-at.bofh.it> |
On Fri, Mar 25, 2016 at 12:12 PM, Tom Browder <tom.browder@gmail.com> wrote: > I have installed Deb on my laptop and reused my old Deb 7 .ssh directory. > > I can now ssh into the existing remote servers but cannot ssh into my > laptop from them (as a normal user)--I always get asked for a > password. So the remote servers recognize my old Deb 7 keys, but > apparently my laptop doesn't recognize the other servers' keys. ... I found this wonderful resource: http://www.unixlore.net/articles/troubleshooting-ssh-connections.html which helped me solve the problem. First, in file '/etc/ssh/sshd_config', I changed the line StrictModes yes to this StrictModes no and restarted the ssh server. As root: # invoke-rc.d ssh restart Then I attempted the ssh login and it worked! Base on the comments from jvp, I looked closer at my home directory on the laptop and, sure enough, the permissions were too loose (first I have ever heard of that, but then again I haven't looked at 'man ssh' in many years). Note that I have for all the years after ssh came along been setting the .ssh permissions correctly, but I've never run into a problem with the home directory. In fact, when I was working at our office on site (up until the end of 2008), we commonly allowed read access between user directories but ssh still worked. But after setting the home directory permissions to 00700 and restarting ssh, the login still didn't work! Then I looked at the resource page where it showed how to debug the whole ssh login session. I used two terminal windows stacked one above the other. In the top window, on the laptop (local host) I became root and executed the following: # /usr/sbin/sshd -d -p 2222 and in the lower window I logged into the remote host and, as my normal user self, executed the following: $ ssh -vv -p 2222 jv2 where 'jv2' is the host name of my laptop. Then, in the upper widow, I saw the problem. Directory '/usr/local', under which my .ssh directory is actually located, was reported to have bad permissions: Authentication refused: bad ownership or modes for directory /usr/local I checked and they were, surprisingly: # ls -ld /usr/local drwxrwsr-x 31 root staff 4096 Mar 24 07:37 /usr/local I don't know how that happened, but it must have happened during the upgrade two days ago when I continued to use my original partition mounted as '/usr/local' which was not supposed to have been touched. Anyway, as root, I fixed the permissions back to what I think is correct: # chmod 00755 /usr/local # ls -ld /usr/local drwxr-xr-x 31 root staff 4096 Mar 24 07:37 /usr/local restarted the ssh server, and the login worked as advertised--whew! Thanks to all who offered help. Best regards, -Tom
[toc] | [next] | [standalone]
| From | David Wright <deblis@lionunicorn.co.uk> |
|---|---|
| Date | 2016-03-26 20:00 +0100 |
| Subject | Re: New Deb 8 and no sshd access from other hosts |
| Message-ID | <rh1Bf-4Nb-1@gated-at.bofh.it> |
| In reply to | #165983 |
A bit early for [SOLVED], I think. On Sat 26 Mar 2016 at 12:08:37 (-0500), Tom Browder wrote: > On Fri, Mar 25, 2016 at 12:12 PM, Tom Browder <tom.browder@gmail.com> wrote: > > I have installed Deb on my laptop and reused my old Deb 7 .ssh directory. > > > > I can now ssh into the existing remote servers but cannot ssh into my > > laptop from them (as a normal user)--I always get asked for a > > password. So the remote servers recognize my old Deb 7 keys, but > > apparently my laptop doesn't recognize the other servers' keys. > ... > I found this wonderful resource: > http://www.unixlore.net/articles/troubleshooting-ssh-connections.html > which helped me solve the problem. > > First, in file '/etc/ssh/sshd_config', I changed the line > StrictModes yes > to this > StrictModes no > and restarted the ssh server. As root: > # invoke-rc.d ssh restart > Then I attempted the ssh login and it worked! Not such a wonderful resource if it is so easily misunderstood. The idea is to fix the permissions, not make your installation less secure. > Base on the comments from jvp, I looked closer at my home directory on > the laptop and, sure enough, the permissions were too loose (first I > have ever heard of that, but then again I haven't looked at 'man ssh' > in many years). Note that I have for all the years after ssh came > along been setting the .ssh permissions correctly, but I've never run > into a problem with the home directory. In fact, when I was working > at our office on site (up until the end of 2008), we commonly allowed > read access between user directories but ssh still worked. > > But after setting the home directory permissions to 00700 and > restarting ssh, the login still didn't work! [...] > Then, in the upper widow, I saw the problem. Directory '/usr/local', > under which my .ssh directory is actually located, was reported to > have bad permissions: > > Authentication refused: bad ownership or modes for directory /usr/local > > I checked and they were, surprisingly: > > # ls -ld /usr/local > drwxrwsr-x 31 root staff 4096 Mar 24 07:37 /usr/local > > I don't know how that happened, but it must have happened during the > upgrade two days ago when I continued to use my original partition > mounted as '/usr/local' which was not supposed to have been touched. I don't know what happened long before that! When did /usr/local become your home directory? > Anyway, as root, I fixed the permissions back to what I think is correct: > > # chmod 00755 /usr/local > # ls -ld /usr/local > drwxr-xr-x 31 root staff 4096 Mar 24 07:37 /usr/local So now the system is degraded a bit more. The correct permissions, in fact the entire contents, are: $ ls -l /usr/ drwxr-xr-x 2 root root 81920 Mar 26 00:59 bin drwxr-xr-x 2 root root 4096 Apr 26 2015 games drwxr-xr-x 39 root root 16384 Feb 16 16:55 include drwxr-xr-x 156 root root 36864 Mar 14 07:16 lib drwxrwsr-x 10 root staff 4096 Oct 10 2012 local drwxr-xr-x 2 root root 12288 Mar 14 07:16 sbin drwxr-xr-x 319 root root 12288 Jan 20 19:22 share drwxr-xr-x 6 root root 4096 Mar 4 00:39 src $ ls -l /usr/local/ drwxrwsr-x 2 root staff 4096 Oct 10 2012 bin drwxrwsr-x 2 root staff 4096 Oct 10 2012 etc drwxrwsr-x 2 root staff 4096 Oct 10 2012 games drwxrwsr-x 2 root staff 4096 Oct 10 2012 include drwxrwsr-x 4 root staff 4096 Dec 15 2014 lib lrwxrwxrwx 1 root staff 9 Oct 10 2012 man -> share/man drwxrwsr-x 2 root staff 4096 Oct 10 2012 sbin drwxrwsr-x 10 root staff 4096 Aug 21 2015 share drwxrwsr-x 2 root staff 4096 Oct 10 2012 src $ So is this really the case as you said it was earlier: $ ls -l ~/.ssh/authorized_keys -rw------- 1 yourname yourname 3136 Jul 28 2015 /home/yourname/.ssh/authorized_keys $ grep yourname /etc/passwd yourname:x:1000:1000:Your Name,,,:/home/yourname:/bin/bash $ Cheers, David.
[toc] | [prev] | [next] | [standalone]
| From | Tom Browder <tom.browder@gmail.com> |
|---|---|
| Date | 2016-03-30 14:10 +0200 |
| Subject | Re: New Deb 8 and no sshd access from other hosts |
| Message-ID | <rin6G-57W-17@gated-at.bofh.it> |
| In reply to | #165994 |
On Saturday, March 26, 2016, David Wright <deblis@lionunicorn.co.uk> wrote: > > A bit early for [SOLVED], I think. I respectively disagree, David. > On Sat 26 Mar 2016 at 12:08:37 (-0500), Tom Browder wrote: > > On Fri, Mar 25, 2016 at 12:12 PM, Tom Browder <tom.browder@gmail.com> wrote: > > > I have installed Deb on my laptop and reused my old Deb 7 .ssh directory. ... > > Not such a wonderful resource if it is so easily misunderstood. The > idea is to fix the permissions, not make your installation less secure. I agree. > > Base on the comments from jvp, I looked closer at my home directory on > > the laptop and, sure enough, the permissions were too loose (first I ... > > Then, in the upper widow, I saw the problem. Directory '/usr/local', > > under which my .ssh directory is actually located, was reported to > > have bad permissions: > > > > Authentication refused: bad ownership or modes for directory /usr/local ...> > > > I checked and they were, surprisingly: > > > > # ls -ld /usr/local > > drwxrwsr-x 31 root staff 4096 Mar 24 07:37 /usr/local > > > > I don't know how that happened, but it must have happened during the > > upgrade two days ago when I continued to use my original partition > > mounted as '/usr/local' which was not supposed to have been touched. ... > I don't know what happened long before that! When did /usr/local > become your home directory? See below. > > Anyway, as root, I fixed the permissions back to what I think is correct: > > > > # chmod 00755 /usr/local > > # ls -ld /usr/local > > drwxr-xr-x 31 root staff 4096 Mar 24 07:37 /usr/local > > So now the system is degraded a bit more. The correct permissions, in > fact the entire contents, are: ... Who says those permissions are correct? I checked the file system standard which says that /usr/local is optional. I provide my own /usr/local partion which I save when reinstalling a new OS and see no reason to provide setuid or setgid for it. When I first started administering Unix systems on SGI in 1993, the user home directories were in /usr/local/people and I kept using that as I transitioned the hosts under my control to Linux systems in 1994. Over the years on my own systems I have found it convenient to keep home system resource directories and files (.bashrc, .profile, .bash_aliase, .xemacs, .ssh, etc.) in a version-controlled, personal directory under /usr/local. I then soft link those back to whatever the newly installed system sets as my home directory. It has worked fine until the Debian 8 install set the permissions as noted which interfered with strict ssh. Anyway, all is well now. Thanks, David. Best regards, -Tom
[toc] | [prev] | [next] | [standalone]
| From | David Wright <deblis@lionunicorn.co.uk> |
|---|---|
| Date | 2016-03-30 22:10 +0200 |
| Subject | Re: New Deb 8 and no sshd access from other hosts |
| Message-ID | <riuBc-28V-7@gated-at.bofh.it> |
| In reply to | #166100 |
On Wed 30 Mar 2016 at 07:02:46 (-0500), Tom Browder wrote: > On Saturday, March 26, 2016, David Wright <deblis@lionunicorn.co.uk> wrote: > > > > A bit early for [SOLVED], I think. > > I respectively disagree, David. Correct me if I'm wrong, but I make the assumption that putting [SOLVED] in the subject line is so that people searching for <some symptom or some problem> will find such a tagged post and be able to follow the method therein to potentially fix their problem. > > On Sat 26 Mar 2016 at 12:08:37 (-0500), Tom Browder wrote: > > > On Fri, Mar 25, 2016 at 12:12 PM, Tom Browder <tom.browder@gmail.com> wrote: > > > > I have installed Deb on my laptop and reused my old Deb 7 .ssh directory. > ... > > > > Not such a wonderful resource if it is so easily misunderstood. The > > idea is to fix the permissions, not make your installation less secure. > > I agree. But it's the first step on your solution post. It would be usual to edit out false trails and red herrings from a solution. > > > Base on the comments from jvp, I looked closer at my home directory on > > > the laptop and, sure enough, the permissions were too loose (first I > ... In the snipped section, you would have people set their home directory permissions to 0700. Debian by default sets them to 0755, which others might be unwittingly relying on. > > > Then, in the upper widow, I saw the problem. Directory '/usr/local', > > > under which my .ssh directory is actually located, was reported to > > > have bad permissions: > > > > > > Authentication refused: bad ownership or modes for directory /usr/local > ...> > > > > I checked and they were, surprisingly: > > > > > > # ls -ld /usr/local > > > drwxrwsr-x 31 root staff 4096 Mar 24 07:37 /usr/local > > > > > > I don't know how that happened, but it must have happened during the > > > upgrade two days ago when I continued to use my original partition > > > mounted as '/usr/local' which was not supposed to have been touched. > ... If this was a Debian installation, one would expect the ownerships and permissions as posted. > > I don't know what happened long before that! When did /usr/local > > become your home directory? > > See below. > > > > Anyway, as root, I fixed the permissions back to what I think is correct: > > > > > > # chmod 00755 /usr/local > > > # ls -ld /usr/local > > > drwxr-xr-x 31 root staff 4096 Mar 24 07:37 /usr/local > > > > So now the system is degraded a bit more. The correct permissions, in > > fact the entire contents, are: > ... > > Who says those permissions are correct? I checked the file system > standard which says that /usr/local is optional. I provide my own > /usr/local partion which I save when reinstalling a new OS and see no > reason to provide setuid or setgid for it. The last paragraph of section 9.1.2 Site-specific programs in the Debian Policy Manual. > When I first started > administering Unix systems on SGI in 1993, the user home directories > were in /usr/local/people and I kept using that as I transitioned the > hosts under my control to Linux systems in 1994. That is very historical. While you're free to configure your system any way you choose, it's not sensible to suggest that others should do this by tagging your post [SOLVED]. AFAICT Linux has never used /usr/local/ in that way. > Over the years on my own systems I have found it convenient to keep > home system resource directories and files (.bashrc, .profile, > .bash_aliase, .xemacs, .ssh, etc.) in a version-controlled, personal > directory under /usr/local. I then soft link those back to whatever > the newly installed system sets as my home directory. It has worked > fine until the Debian 8 install set the permissions as noted which > interfered with strict ssh. Again, you're free to configure your system any way you choose. However, /usr should effectively be readonly software with, possibly, configuration files, whereas your .ssh/ directory is not readonly; for example, known_hosts and authorized_keys get modified on the fly. So your way of fixing your problem is not a general solution for anyone because most of the post concerns your highly individually configured system. That's what made me unhappy about your [SOLVED] tag. I hope you'll understand. Cheers, David.
[toc] | [prev] | [next] | [standalone]
| From | Andrew McGlashan <andrew.mcglashan@affinityvision.com.au> |
|---|---|
| Date | 2016-03-26 22:20 +0100 |
| Message-ID | <rh3MK-6Ai-7@gated-at.bofh.it> |
| In reply to | #165983 |
[Multipart message — attachments visible in raw view] — view raw
On 27/03/2016 4:08 AM, Tom Browder wrote: > On Fri, Mar 25, 2016 at 12:12 PM, Tom Browder <tom.browder@gmail.com> wrote: >> I have installed Deb on my laptop and reused my old Deb 7 .ssh directory. >> >> I can now ssh into the existing remote servers but cannot ssh into my >> laptop from them (as a normal user)--I always get asked for a >> password. So the remote servers recognize my old Deb 7 keys, but >> apparently my laptop doesn't recognize the other servers' keys. > ... > > I found this wonderful resource: > > http://www.unixlore.net/articles/troubleshooting-ssh-connections.html That was a JIT find (just in time).... only written up 26th March, 2016. Once you have everything good, make sure that you change StrictModes back to default. I usually restrict with known IP addresses (static ones) and sometimes with users having to be in a specific group that allows ssh. Also, authorized keys enforced instead of passwords. Cheers A.
[toc] | [prev] | [next] | [standalone]
| From | Tom Browder <tom.browder@gmail.com> |
|---|---|
| Date | 2016-03-27 00:10 +0100 |
| Message-ID | <rh5vc-7VU-13@gated-at.bofh.it> |
| In reply to | #165999 |
[Multipart message — attachments visible in raw view] — view raw
On Saturday, March 26, 2016, Andrew McGlashan < andrew.mcglashan@affinityvision.com.au <javascript:_e(%7B%7D,'cvml','andrew.mcglashan@affinityvision.com.au');>> wrote: > > On 27/03/2016 4:08 AM, Tom Browder wrote: > > On Fri, Mar 25, 2016 at 12:12 PM, Tom Browder <tom.browder@gmail.com> > wrote: ... > > I found this wonderful resource: > > > > http://www.unixlore.net/articles/troubleshooting-ssh-connections.html > > That was a JIT find (just in time).... only written up 26th March, 2016. JIT, indeed! I hadn't noticed the date! I give my thanks to the author(s). (I haven't found any attribution there yet.) > Once you have everything good, make sure that you change StrictModes > back to default. Thanks, Andrew. I did but forgot to say so. > I usually restrict with known IP addresses (static ones) and sometimes > with users having to be in a specific group that allows ssh. Also, > authorized keys enforced instead of passwords. At the moment I'm the sole user, although I'm considering giving limited access to a few folks later. How do you manage the server while traveling--some kind of personal VPN? Best regards, -Tom
[toc] | [prev] | [next] | [standalone]
| From | Andrew McGlashan <andrew.mcglashan@affinityvision.com.au> |
|---|---|
| Date | 2016-03-27 00:40 +0100 |
| Message-ID | <rh5Yd-8f7-9@gated-at.bofh.it> |
| In reply to | #166003 |
[Multipart message — attachments visible in raw view] — view raw
Hi, On 27/03/2016 10:04 AM, Tom Browder wrote: > On Saturday, March 26, 2016, Andrew McGlashan > I usually restrict with known IP addresses (static ones) and sometimes > with users having to be in a specific group that allows ssh. Also, > authorized keys enforced instead of passwords. > > At the moment I'm the sole user, although I'm considering giving limited > access to a few folks later. How do you manage the server while > traveling--some kind of personal VPN? I have access to a couple of servers via a secure RDP tool [1] that I can work from, those servers have a static IP and those IPs are in my allowed list. Firewall's stop access unless it isn't coming from the right locations and I also implement hosts.deny and hosts.allow in the mix. I used to have a static IP HSPA service, I should have kept that as it gives static IP on a 4G LTE network (actually I think it was only a 3G network). In the past I have rebuilt an Oracle database from export dump files via a Nokia 9000 Communicator's terminal app with a 9600 baud GSM modem.... who say's Apple were first to /real/ smart phones ;-) Have considered port knocking, but never set that up. There are lots of options I can work with, even an email to my own mail server, specially crafted to run a script to open up the connecting IP. Another option would be to setup OpenVPN.... that shouldn't be too hard, but I haven't had to do it, yet. So, right now, it is more simple with the AADS servers being available. Kind Regards AndrewM [1] http://aads-worldwide.com/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web