I’m trying to use SSH / WinSCP3 with a LAMP install and whenever I login to the machine, I’m immediately taken to the home / user / _______ directory. In this directory, I have the following directories:
Desktop, Downloads, Music, Public, Videos, Documents, GPG-KEY-DRBL, Pictures, and Templates.
I have no clue why it would initially set me to land here when I login. Why is this?
What I’m trying to do is have SSH or WinSCP3 log me into the “www” directory so that I can have access to all my web projects. Ironically, whenever I travel to this directory and try to edit ANYTHING outside the directory I mentioned above, it throws up walls about permissions, etc. Obviously, I’ve done something wrong here but just can’t wrap my head around it…
I want to be able to log into the “www” folder directly and have full control over everything in this directory. Everything else (AFAIC) shouldn’t even have read rights, but whatever–just as long as it’s not write or execute (unless some of you beg to differ).
What do I have to do to fix this? I can write to files using sudo (of course) but I shouldn’t have to use this sudo command to do everything from editing html files to uploading things, should I? Any help is appreciated.
You are probably logging in as home/user/. This is default behaviour for you to be directed straight to the users directory. Likewise, you can’t read or write anywhere because the user you are logged in as does not have sufficient permissions.
You can read the contents of a directory because the folder permission says you can.
To edit the web files, you just have to make sure your user has privilege to do so. Generally you just change the web file owner to your user.
My knowledge is somewhat limited as to how to change the initial directory path, but i’m sure it can be done with a command.
Just log on through winscp with a user account with sufficient permissions to edit the www files instead of using your user account. For security reasons you don’t want a web server where any user can alter web files, and there are more security issues if you allow web files from a user home directory. Refer to the apache documentation, there are special steps the server admin needs to take to allow home directory web pages.
Also in winscp there are a couple settings about ‘directory’ in the advanced settings. I’ve never messed with them, I don’t know if such a setting will let you set a start directory. Otherwise, as mentioned you’re seeing normal behavior.
Okay, well I was able to figure out how to make WinSCP3 log me into the www directory directly, so that’s fixed now.
The only issue left, however, is figuring out how to allow the user I log in as (who is also the user that created the Linux install to begin with) to create, read, edit, and execute anything I need. The thing I find weird out of all this is that I just tried to log in and create a simple PHP file with nothing more than an echo statement, and after redundantly reentering my password to verify my authentication, it still wouldn’t allow me to create this file as the following error message within WinSCP came up:
Does this mean I need to somehow reassign my user’s privileges? Otherwise, I need to use “SUDO” within a console just to reassign privileges of the “www” directory? Right now, I’m unable to use the GUI / KDE to reassign the privileges of the “www” directory.
By the way, the current privileges of the “www” directory is “drwxr-xr-x”.
Update… I just did a chmod 755 on “www” and it’s still giving me issues… Any ideas or am I just being dense about something you guys already tried to tell me here…?
Sorry guys… I think I figured it out. I had to change the ownership to the user name I’m using (from root to my user name).
This seems to fixed it, but feel free to let me know of any haphazard I’ve probably created by doing this–as this is usually the case with these things I get myself into! Ha.
yes that sounds right, that was what I meant originally when I said just change the web file owner to the user you are logging in as.
Keep in mind, depending on your setup, about what Doug G said about ensuring that other users of the system can’t access your web files - they should have the least amount of access possible.
If you are not sharing the server with other users then this is not a concern, though you should make sure the apache user (usually www-data) cannot access the files.