Server is set up, now what?

Discussion in 'Server Operation' started by Carlo Gambino, Jul 20, 2008.

  1. Carlo Gambino

    Carlo Gambino New Member

    ***Warning- I'm in new teritory so feeling a bit No0b-ish***

    I have gotten the server all configured (I think). I want to load a couple simple web pages to it. I have been able to log into the server via ftp, which takes me directly into the root directory. I need the files to upload into /var/www, but I can not seem to get access from the ftp client. Is there a way to change this? I know there should be a way to upload the files to the proper directory.

    Thanks for the input and encouragement in advance!
     
    Last edited: Jul 20, 2008
  2. ralic

    ralic New Member

    If you are only accessing the box on a local area network then ftp would probably be ok, but it would be worthwhile to use something more secure like scp or sftp. normal ftp passes username and password data in clear text on the network. Anyone else listening on the wire (or wireless) can pick it up and use it against you.

    In order to write to /var/www you need to log in as a user with permissions to do that. Short term, probably root would be ok, but heed the warning above about passwords.

    In ftp you navigate much like inside a shell. After login you are placed in your home directory, and navigate around by using 'cd' command. e.g. cd /var/www to get to /var/www and cd .. to go up one dir. You can use 'ls' to see available dirs. Use 'put filename' to push files to the server into the current directory, and 'get filename' to pull the file into your local current directory.

    The synatx for scp in its simplest form for pushing fiiles would be:
    Code:
    scp sourcefile user@destinationhost:/dest/dir/destfilename
    e.g. scp index.html root@mybox:/var/www
    To get files, you swap the source and destination.
    Code:
    scp user@destinationhost:/source/dir/sourcefilename /dest/local/dir/destfilename 
    e.g. scp me@mybox:/home/me/myfilename /home/me/myfilename
    That should be enough to get you up and running quickly and you can review the docs for more information.
     
  3. Carlo Gambino

    Carlo Gambino New Member

    I hand't taken into consideration the insecurity of FTP, thank you for the suggestion. I was following a tut on the server setup and was in auto-pilot mode at the time. I will be installing winSCP on the windows machines, but do you have any input on advantages of Nautilus over Konqueror or vice versa?

    Code:
    In order to write to /var/www you need to log in as a user with permissions to do that. Short term, probably root would be ok, but heed the warning above about passwords.
    I presume I can change permissions to that file in typical fashion. I only have one user setup on the server at the moment, but as that changes, I intend to add specific users to a group that will have access to the directory.

    Perhaps I'm doing something wrong. I have been using filezilla to this point, and when I input the command:
    Code:
    cd /var/www
    to the "Remote Site:" area, I get:
    Code:
    Command:	CWD /cd /var/www
    Response:	550 /cd /var/www: No such file or directory
    Error:	Failed to retrieve directory listing
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Try to put in /var/www only (no cd).
     
  5. ralic

    ralic New Member

    Afraid not, mostly a command line user myself. ;) Perhaps a browse around the ubuntu forums may offer some insights on that.

    /var/www is a directory and is the default location of the root of your default web site (i.e. http://host.domain.name/). Yes, you can change the permissions, but beware that the owner of the web server (www-data for apache2) must have read access in order to serve the pages to your visitors, so be careful not to change the permissions in such a way that the web server cannot read the files anymore. You might add your users to the group that already owns that directory (also www-data for apache2), but there will likely be some security implications in that those users may then have access to other areas restricted to www-data user. I don't have much experience in hosting for multiple users, but since it's a reasonably common practice these days, you should find loads of hints or best practice advice on the web. Maybe that's a possible new HOWTO suggestion? ;)

    Ok, my error. I had thought you were using the command line. Sorry about that. Navigating in filezilla is much like navigating in explorer. Double click on directory names to gain access and double click on ".." to traverse back up to /. If you still don't succeed to upload files, then it's more than likely due to permissions on the directory you are trying to save the files into. Try uploading them to your home dir. If that works, you know that you are taking the correct action, but being blocked by permissions.
     
    Last edited: Jul 21, 2008
  6. Carlo Gambino

    Carlo Gambino New Member

    I tried this and got:
    Code:
    Command:	CWD /var/www
    Response:	550 /var/www: No such file or directory
    Error:	Failed to retrieve directory listing
    which made me think maybe the directory can only be accessed by root at the moment. I tried to connect to root via FTP and was unsuccessful.

    Thanks for the insight. I'd like to learn the command line as much as possible, that's part of what brought me to Linux. I presume there is a way to FTP from the command line, so I'll be looking into that as well. I am quite active in Ubuntu Forums and will be looking for help there as well.

    I was going to start playing with the permissions, but decided not to since you mentioned possible security issues. Is there anyone who can guide me to the most secure and efficient way to add users to the group, or perhaps advise me on alternate methods (perhaps changing the directory Apache looks to to serve files is a better choice)? I really don't know if that's even an option, I'm still learning.

    I tried that first, I am used to using filezilla as I have a hosted website currently. I have tried to navigate both graphically and via the command line, but seem to be unsuccessful. I was thinking this to be another cause of /var/www being only accessible by root, but I tried other directories to no avail.
     
  7. ralic

    ralic New Member

    Yup, command is generally just ftp followed by hostname you wish to connect to:
    ftp host.domain.name

    I'm starting to suspect that it may not exist. Can you establish a shell connection to the server and list the dir?
    Code:
    me@myhost:~$ ls -ld /var/www
    drwxr-xr-x 2 root root 4096 2008-07-08 10:50 /var/www
    Or maybe the web server installed was not apache? Which tut were you following? Maybe more answers available there.
     
  8. Carlo Gambino

    Carlo Gambino New Member

    This is odd.

    After taking your suggestion, I installed winSCP on the windows machine I'm doing most of the work from. I was able to connect and navigate to /var/www! I was also able to establish a shell connection and list the directory:

    Code:
    administrator@arena:/etc/apache2# ls -ld /var/www
    drwxr-xr-x 4 root root 4096 2008-07-21 18:01 /var/www
    This leads me to more questions, though I don't know if this is the place to answer them. I have been able to understand how to change the root directory, but I'm wondering if that is a better choice than changing the owner and/or group that the directory belongs to? I just want to be sure there are no security issues I'm overlooking.
     
  9. ralic

    ralic New Member

    Ok, that's good. Maybe something in the ftp server implementation is causing the grief?
    I guess the default is fine for testing your web server setup, but probably implementing virtual sites for each user is better for multiple users. Each virtual site would have its documentroot in the user's home directory, that way you only need to enable/disable a site and not worry about the security permissions as they will be the same as any particular user's.
    I guess we can explore the virtual site option in your other thread. ;)
     
  10. zcworld

    zcworld New Member

    its comes down to what username your FTP( your logon account to your linux box) account is and does it have access rights to the /var/www folder

    just add that FTP account name to groups and try that

    see if thats works
     
  11. ryazkhan

    ryazkhan New Member

    I am sorry but ftp is very bad solution because it send clear password which is not good thing I would never use ftp for administration. Second thing you said it directly log you in as root I dont know why you doing that, you never want to access your root form protocol like ftp and possibly you never want to set password for root because whenever you need root access just do sudo bash (this is ubuntu and other related linux). Please use SSH to do any kind of file transfer over internet.
     

Share This Page