1

I cannot find the public_html file from the PuTTY terminal when accessed through SSH giving valid public-private-key(PPK) file,

But when accessed from the FileZilla Client software, I can see the public_html file/folder

enter image description here

These below commands are from PuTTY:

login as: ubuntu
Authenticating with public key "imported-openssh-key"
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-1021-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Tue Oct 16 11:15:23 UTC 2018

  System load:  0.0                Processes:           122
  Usage of /:   11.4% of 29.02GB   Users logged in:     1
  Memory usage: 48%                IP address for eth0: 172.31.36.103
  Swap usage:   0%

 * Security certifications for Ubuntu!
   We now have FIPS, STIG, CC and a CIS Benchmark.

   - http:// bit.ly/Security_Certification

 * Want to make a highly secure kiosk, smart display or touchscreen?
   Here's a step-by-step tutorial for a rainy weekend, or a startup.

   - https:// bit.ly/secure-kiosk


  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

26 packages can be updated.
0 updates are security updates.


*** System restart required ***
Last login: Tue Oct 16 10:57:13 2018 from 117.247.121.115
ubuntu@ec2-3-193-123-96:~$ ls -lr
total 56
-rw-r--r-- 1 root root  1711 Sep 28 18:18 vst-install.sh
-rw-r--r-- 1 root root 45453 Aug  9 14:25 vst-install-ubuntu.sh
-rw-r--r-- 1 root root  1719 Sep 30  2013 deb_signing.key
ubuntu@ec2-3-193-123-96:~$ cd ..
ubuntu@ec2-3-193-123-96:/home$ ls -lr
total 8
drwxr-xr-x 5 ubuntu ubuntu 4096 Oct  9 17:43 ubuntu
drwxr-xr-x 9 admin  admin  4096 Oct  7 06:20 admin
ubuntu@ec2-3-193-123-96:/home$ cd ..
ubuntu@ec2-3-193-123-96:/$ cd ..
ubuntu@ec2-3-193-123-96:/$ ls -lr
total 92
lrwxrwxrwx   1 root root    28 Sep 12 16:16 vmlinuz.old -> boot/vmlinuz-4.15.0-1021-aws
lrwxrwxrwx   1 root root    28 Oct  2 06:52 vmlinuz -> boot/vmlinuz-4.15.0-1023-aws
drwxr-xr-x  16 root root  4096 Sep 28 18:23 var
drwxr-xr-x  10 root root  4096 Sep 12 15:55 usr
drwxrwxrwt  14 root root  4096 Oct 16 11:15 tmp
dr-xr-xr-x  13 root root     0 Oct 16 10:15 sys
drwxr-xr-x   3 root root  4096 Sep 28 18:21 srv
drwxr-xr-x   5 root root  4096 Sep 28 17:39 snap
drwxr-xr-x   2 root root  4096 Oct  5 06:12 sbin
drwxr-xr-x  32 root root  1220 Oct 16 11:15 run
drwx------   5 root root  4096 Oct 15 13:38 root
dr-xr-xr-x 134 root root     0 Sep 28 17:38 proc
drwxr-xr-x   2 root root  4096 Sep 12 15:55 opt
drwxr-xr-x   2 root root  4096 Sep 12 15:55 mnt
drwxr-xr-x   2 root root  4096 Sep 12 15:55 media
drwx------   2 root root 16384 Sep 12 16:10 lost+found
drwxr-xr-x   2 root root  4096 Sep 12 15:56 lib64
drwxr-xr-x  20 root root  4096 Sep 28 18:22 lib
lrwxrwxrwx   1 root root    31 Sep 12 16:16 initrd.img.old -> boot/initrd.img-4.15.0-1021-aws
lrwxrwxrwx   1 root root    31 Oct  2 06:52 initrd.img -> boot/initrd.img-4.15.0-1023-aws
drwxr-xr-x   4 root root  4096 Sep 28 18:23 home
drwxr-xr-x 115 root root 12288 Oct  5 06:12 etc
drwxr-xr-x  15 root root  2980 Sep 28 17:39 dev
drwxr-xr-x   3 root root  4096 Oct  2 06:52 boot
drwxr-xr-x   2 root root  4096 Sep 12 15:59 bin
drwxr-xr-x   2 root root  4096 Oct 16 05:10 backup
ubuntu@ec2-3-193-123-96:/$ cd var
ubuntu@ec2-3-193-123-96:/var$ ls -lr
total 56
drwxr-xr-x  4 root  root   4096 Sep 28 18:22 www
drwxrwxrwt  7 root  root   4096 Oct  5 06:12 tmp
drwxr-xr-x  5 root  root   4096 Sep 28 18:20 spool
drwxrwxrwx  2 admin admin  4096 Oct 16 11:15 softtmp
drwxr-xr-x 65 admin admin  4096 Oct 15 13:38 softaculous
drwxr-xr-x  4 root  root   4096 Sep 28 17:39 snap
lrwxrwxrwx  1 root  root      4 Sep 12 15:55 run -> /run
drwxr-xr-x  2 root  root   4096 Sep 12 15:55 opt
drwxrwsr-x  2 root  mail   4096 Sep 12 15:55 mail
drwxrwxr-x 16 root  syslog 4096 Oct 16 06:25 log
lrwxrwxrwx  1 root  root      9 Sep 12 15:55 lock -> /run/lock
drwxrwsr-x  2 root  staff  4096 Apr 24 08:34 local
drwxr-xr-x 55 root  root   4096 Sep 28 18:22 lib
drwxrwxrwt  2 root  root   4096 Sep 12 15:58 crash
drwxr-xr-x 18 root  root   4096 Sep 28 18:22 cache
drwxr-xr-x  2 root  root   4096 Oct 16 06:25 backups
ubuntu@ec2-3-193-123-96:/var$

How is it possible to connect to AWS EC2 instance and find the public_html file via PuTTY terminal?

2

Using putty terminal using SSH will automatically log you in with the top level directory structure while using FTP will be bound to whatever is set within your config.

You will normally find public_html within /home/username or /var/www/example.com

Other than that you can easily find the directory by viewing the FTP config and see what is being shared as when you log in using FTP.

  • Connecting it to SFTP connection that indeed gave me the clear picture – Nɪsʜᴀɴᴛʜ ॐ Oct 17 '18 at 4:59
  • SFTP uses SSH but usable like FTP. – Simon Hayter Oct 17 '18 at 16:32
1

Yes, whatever that Simon Hayter♦ said was right after all.

In order to solve this issue, I had connected FileZilla Client software via SFTP connection. It clearly showed the directory structure where does the public_html reside

/home/admin/web/ec2-3-193-123-96.eu-central-1.compute.amazonaws.com/public_html

enter image description here So I changed the ownership to the user ubuntu recursively, so that the user ubuntu have every right permitted

sudo chown -R ubuntu /home/admin/web
sudo chmod 755 /home/admin/web

Finally, the Ubuntu user has complete access to the public_html file when logged with SSH credentials.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.