re-enable tilde-username (~username)

arjena

Verified User
Joined
May 26, 2013
Messages
54
When my (VPS-CentOS) server was newly set up and DA just installed, a new user could access his/her domain by typing IP/~username. Somehow along the way this option is removed, most likely after I installed CSF.
I would like to re-enable this option. Preferably only for newly created accounts so I can disable it when the domain name resolves, but if this is not possible I would like to know how to enable/disable this option system-wide.
I know enabling this is a risk because users can bypass the quota system, but since it's only me and a couple of friends on this server I'm not concerned about that.

Thanks,

Arjen
 
You have to check two things.
First, check /etc/httpd/conf/extra/httpd-vhost.conf and if commented, then uncomment these lines:
Code:
 AliasMatch ^/~([^/]+)(/.*)* /home/$1/public_html$2

Second edit your /etc/httpd/conf/extra/httpd-userdir.conf and put userdir on enabled.

Remember to restart apache and then it should be working serverwide.

You could also try to leave it enabled in userdir and disable it again (in httpd-userdir.conf) for certain users after the domain resolves like this:
Code:
UserDir enabled
UserDir disabled root paul john foo

However I have never tested this last setting this way.
 
Hi Richard,

Thanks for the directives. However, no luck. I've checked both files and they both seem to be like you suggested. I've restarted Apache just to be sure but I still get "The requested URL /~username was not found on this server (where of course "username" is substituted by the name of one of my users).
So it seems there must be another 'config' file I need to check. I've re-checked CFS but there is no mention of userdir there.
I also installed mod_ruid, could that have anything to do with this?

Tnx,

Arjen
 
I don't recall doing so, but I checked anyway. Alias lines are still there, and there are no files in the 'custom' directory. So that's not the cause either.

Thanks anyway,

Arjen
 
I also installed mod_ruid, could that have anything to do with this?
No, and neither has the installation of CSF/LFD.

I've checked both files and they both seem to be like you suggested.
So did you enable the userdir directive in the httpd-userdir.conf then? Because it's disabled by default.

Check the lower part of /etc/httpd/conf/httpd.conf and see if
Include conf/extra/httpd-userdir.conf
is not checked out by a #.
 
Thanks for your reply. Been a bit busy for a couple of weeks, but I'm back to tackle this problem.
Just checked if "Include conf/extra/httpd-userdir.conf" is commented out. It is not.
So there must be another place where this is disabled.

Thanks,

A
 
I get just this (the same for all accounts, no matter if I use a valid username or a random one):

Not Found

The requested URL /~username was not found on this server.
 
access_log is empty except for one line:

localhost - - [24/Jun/2013:23:07:03 +0200] "GET /server-status HTTP/1.1" 404 561

error_log repeats this a couple of times a day, but that's another matter I think:

[Thu Jun 27 17:19:01 2013] [notice] caught SIGTERM, shutting down
[Thu Jun 27 17:19:02 2013] [notice] SSL FIPS mode disabled
[Thu Jun 27 17:19:02 2013] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Thu Jun 27 17:19:02 2013] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Jun 27 17:19:02 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Jun 27 17:19:03 2013] [notice] SSL FIPS mode disabled
[Thu Jun 27 17:19:03 2013] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!?
[Thu Jun 27 17:19:03 2013] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Jun 27 17:19:03 2013] [notice] mod_ruid2/0.9.7 enabled
[Thu Jun 27 17:19:03 2013] [notice] Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips DAV/2 PHP/5.4.8 configured -- resuming normal operations

Is there a specific log you want me to check?
 
Thus, no mention of username in apache logs? And what about domains sub-directory?

You probably need to run

Code:
./build rewrite_confs

p.s. By the way do you run single apache? Or in conjunction with a reverse proxy?
 
Thanks again for your reply. Nope, no mention of (any) username in any log. Just skimmed through them all, only 5 domains running on my server so that does not take too long.
I also tried rewrite the conf files from /usr/local/directadmin/custombuild, still no access at ~username.
Your last question makes me feel like the amateur I really am. I haven't got a clue what you mean by single apache and or reverse proxy.
 
By the way, Richard mentions uncommenting the line

Include conf/extra/httpd-userdir.conf

in /etc/httpd/conf/httpd.conf

However, this line is in a section below the line where it says "Do not change anything in included files, because they are rewritten by DirectAdmin".
After I did the ./build rewrite_confs I decided to check this file and the line was commented out again. Uncommenting it makes no difference, but if DirectAdmin comments this line out, apparently I need to change a DirectAdmin setting somewhere. Does this make sense?
 
Yes that make sense.
Try this if you are running custombuild 1.2 (I don't know if this also works this way on CB2.0):
Code:
mkdir -p /usr/local/directadmin/custombuild/custom/ap2
mkdir -p /usr/local/directadmin/custombuild/custom/ap2/extra
cp /etc/httpd/conf/httpd.conf /usr/local/directadmin/custombuild/custom/ap2
cp /etc/httpd/conf/extra/httpd-userdir.conf /usr/local/directadmin/custombuild/custom/ap2/extra
Now uncomment the line in the httpd.conf in the newly made ap2 directory.
Next to that, go to the newly made /ap2/extra directory and edit httpd-userdir.conf and change disabled to enabled.
If you do a rebuild now, it should be oke if I'm correct.
Don't forget to restart apache too.
 
Thanks for your reply. Like I said before, I'm not an expert so maybe I get this completely wrong, but if I understand correctly this method only prevents DirectAdmin from changing the conf file back to it's default setting. I will try that when I have more time, but what I was hoping for is a setting in DirectAdmin that 'uncomments' the userdir line in the conf file.
 
but if I understand correctly this method only prevents DirectAdmin from changing the conf file back to it's default setting
Yes it prevents DA from changing it back to it's default when doing a ./build rewrite_confs, that's correct.
There is no setting in DA which uncomments that line for you, sorry.
 
Thanks, I'll try that later even though uncommenting the line did not help the first time.
 
It's both uncommenting the line in httpd.conf -and- change "disabled" to "enabled" in /extra/httpd-userdir.conf.
And ofcourse restart httpd.;)
 
Yes, of course. I did both, but still no luck. I even restarted the whole server once just for good measure, but that did not help either. If I ever find what's causing this problem it will most likely be something in the 'why didn't I think of that in the first place' category...
 
Back
Top