Permissions Denied - After successful connection as 'root' ONLY when connecting externally

1

So, I have been using Ubuntu Server 12.04.01 for the past couple of weeks after using Ubuntu Desktop 13.10 for about a couple of months and find it a refreshing start after switching over from the Windows environment types.

All is good except for a one thing that I have been troubleshooting for some time and for the life of me, can not figure out.

I have open-ssh installed on my Ubuntu server and I am able to successfully connect to it via SSH using Windows’ client putty program on port 22 (default). The only changes I have made are to my sshd_config file located on my server in the /etc/ssh/ directory. The config info is also listed with the other info (if there is any other info that I can provide that may help out, let me know).

Version of SSH installed:

root@juggernaut:~# dpkg -l | grep "ssh"
ii  openssh-client                     1:5.9p1-5ubuntu1.3         secure shell (SSH) client, for secure access to remote machines
ii  openssh-server                     1:5.9p1-5ubuntu1.3         secure shell (SSH) server, for secure access from remote machines
ii  ssh-import-id                      2.10-0ubuntu1              securely retrieve an SSH public key and install it locally

Permissions on /:

root@juggernaut:~# ls -lah /
total 84K
drwxr-xr-x 22 root root 4.0K Jan  2 06:49 .
drwxr-xr-x 22 root root 4.0K Jan  2 06:49 ..
drwxr-xr-x  2 root root 4.0K Jan  2 06:45 bin
drwxr-xr-x  3 root root 4.0K Jan  2 06:52 boot
drwxr-xr-x 14 root root 4.0K Jan  2 13:44 dev
drwxr-xr-x 88 root root 4.0K Jan  3 18:25 etc
drwxr-xr-x  3 root root 4.0K Jan  1 17:59 home
lrwxrwxrwx  1 root root   37 Jan  2 06:49 initrd.img -> /boot/initrd.img-3.2.0-74-generic-pae
lrwxrwxrwx  1 root root   37 Jan  1 15:08 initrd.img.old -> /boot/initrd.img-3.2.0-29-generic-pae
drwxr-xr-x 18 root root 4.0K Jan  2 06:44 lib
drwx------  2 root root  16K Jan  1 15:03 lost+found
drwxr-xr-x  3 root root 4.0K Jan  1 15:07 media
drwxr-xr-x  2 root root 4.0K Aug  3  2012 mnt
drwxr-xr-x  2 root root 4.0K Jan  1 15:04 opt
dr-xr-xr-x 80 root root    0 Jan  2 13:44 proc
drwx------  4 root root 4.0K Jan  3 18:25 root
drwxr-xr-x 15 root root  540 Jan  3 18:25 run
drwxr-xr-x  2 root root 4.0K Jan  2 06:48 sbin
drwxr-xr-x  2 root root 4.0K Mar  5  2012 selinux
drwxr-xr-x  2 root root 4.0K Jan  1 15:04 srv
drwxr-xr-x 13 root root    0 Jan  2 13:44 sys
drwxrwxrwt  3 root root 4.0K Jan  3 18:17 tmp
drwxr-xr-x 10 root root 4.0K Jan  1 15:04 usr
drwxr-xr-x 12 root root 4.0K Jan  2 13:43 var
lrwxrwxrwx  1 root root   33 Jan  2 06:49 vmlinuz -> boot/vmlinuz-3.2.0-74-generic-pae
lrwxrwxrwx  1 root root   33 Jan  1 15:08 vmlinuz.old -> boot/vmlinuz-3.2.0-29-generic-pae    

But when I connect to my server as root successfully within the LAN (internal network), I have full access to every location within my server via ssh, as if I was connected at the server console itself.

But, when I am connect to the server via SSH externally via my public IP/network’s hostname, I only get a

$

As a prompt after successfully logging in as root – no banner, motd, NOTHING ELSE like I would if I had connected to the server on LAN. With that said, I can browse a just about every location and stuff, but when I ‘cd’ to the ‘/etc’ directory, I get the message:

ls: can’t open ‘.’: Permission denied

I have done my due time by searching the web, but to know luck. Hopefully there is some MINOR setting I am missing.

Adam Clark

Posted 2015-01-04T03:25:15.077

Reputation: 21

Are you sure you are connecting to the machine you think you are? It sounds like you may be connecting to the router's console. If you set up port forwarding on your router, try changing the incoming port and verifying you can still connect. – Chris Nava – 2015-01-04T04:59:46.303

Answers

1

  1. Made a remote connection (from a external source) via SSH.
  2. After successfully logging in a root, performed the ifconfig command.
    • Noticed immediately that the IP address was infact the LAN IP addess of my gateway router.
  3. The next step was disabling the port forward I THOUGHT was correctly setup.
  4. I attempted to reconnect again (from a external source) via SSH -- and behold, I am still able to connect.
  5. Did step 2 of this list again and same info! (Now I'm getting somewhere -- thanks Chris Nava)
  6. Now, I disable SSH to the gateway router (I had set this up previously without remembering it was enabled).
  7. I once again attempted to reconnect again (from a external source) via SSH -- I get a timeout notification.
  8. So far so good -- I re-enable port forwarding to the SSH server and BAM! All problems solved.

Well, goes to show, that if your not using it, DISABLE IT! Learned my lesson the hard way.

Adam Clark

Posted 2015-01-04T03:25:15.077

Reputation: 21