How to get the absolute path to the public_html folder with SSH?

djsmiley2k

Well-known member
Registered
Joined
Jul 10, 2016
Messages
198
Points
18
Normally I used this command to find current path for the folder on SSH that moved to there

Code:
pwd
but I would like to know all current path to public_html for all users on my VPS. Is that possible?
for instances
/home/myusername1/public_html
/home/myusername2/public_html
/home/myusername3/public_html


and how?
 

SmileServe

Member
Hosting Provider
Registered
Joined
Oct 16, 2017
Messages
55
Points
8
Are you running cPanel on this VPS? If so, the path structure is likely to be the same for all users. Perhaps I am not understanding your purpose behind needing this though?
 
Last edited:

mobin

Well-known member
Registered
Joined
Jun 22, 2017
Messages
234
Points
28
This depends on your requirement and the platform you are using. It needs custom scripting / checks to get all user dir details if you are in a custom set up. if you are using cPanel it is fairly easy. But what actual information you are looking for? Do you want to get the DocRoot of all domains / users? If so, following command will be helpful for you.

grep DocumentRoot /usr/local/apache/conf/httpd.conf
 

djsmiley2k

Well-known member
Registered
Joined
Jul 10, 2016
Messages
198
Points
18
Are you running cPanel on this VPS? If so, the path structure is likely to be the same for all users. Perhaps I am not understanding your purpose behind needing this though?
I want to get the path to apply to chown command in this thread https://forumweb.hosting/13371-how-...-(chmod)-of-files-folders-or-sub-folders.html

This depends on your requirement and the platform you are using. It needs custom scripting / checks to get all user dir details if you are in a custom set up. if you are using cPanel it is fairly easy. But what actual information you are looking for? Do you want to get the DocRoot of all domains / users? If so, following command will be helpful for you.
Where to run this command?

I run it on SSH and returned this

[root@server ~]# grep DocumentRoot /usr/local/apache/conf/httpd.conf
grep: /usr/local/apache/conf/httpd.conf: No such file or directory
[root@server ~]#
 

mobin

Well-known member
Registered
Joined
Jun 22, 2017
Messages
234
Points
28
mobin
Looks like you have no cPanel on your server. Perhaps you need to find out the DocumentRoot of each of your domains from your web server configuration manually. Either way, be very careful with "chown -R" command..it can interrupt your website functioning if you don't know your server set up completely.
 
Older Threads
Replies
5
Views
4,573
Replies
21
Views
26,487
Replies
8
Views
4,363
Replies
2
Views
1,631
Latest Threads
Replies
0
Views
31
Replies
0
Views
46
Replies
1
Views
72
Replies
1
Views
78
Recommended Threads
Replies
10
Views
3,891
Replies
2
Views
3,022
Replies
6
Views
2,832

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top