Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26

Thread: uploading files to LAMP on UBUNTU Desktop

  1. #11
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: uploading files to LAMP on UBUNTU Desktop

    A note on the changes in the apache configuration. The documentroot is where apache looks for files for the website. So that was the first change in that file.

    The second change is due to the first change as we have to tell apache what can be done with that directory.
    If you don't make backups of your important data, your data is obviously not important to you.

  2. #12
    Join Date
    Oct 2012
    Beans
    16

    Re: uploading files to LAMP on UBUNTU Desktop

    Your directions were great. I was able to follow them step-by-step and the result was that I was finally able to see the files and folders in Filezilla, rename them, and upload to the folders. I was smiling.

    Because it was already set up for it, I tested the tricks mentioned above while using Filezilla with the user name as the UBUNTU the super user “ray”. However, when I attempted to browse to the location using Firefox, (/home/ray/website1/www) I was unable to find the files that I had parked there. 404 error.

    I had substituted “rgc” for “testuser” in the examples that you provided and tried “/home/rgc/website1/www” in Firefox, confident that this would solve the problem and still got a 404 error.

    So I then returned to Filezilla and tried using it with the “rgc” user name which I had set up earlier in UBUNTU using the GUI but it didn’t ask for a password at the time and Filezilla wasn’t going to be happy without one. A quick browse revealed how to add a password to an existing user. Done! I tested the new “rgc” user and password. It worked fine.

    And I think that there is where the train went off the rails. Now Filezilla fails to connect to the UBUNTU server either as "rgc” or “ray”. Big trouble.


    Error: Could not connect to server
    Status: Waiting to retry...
    Status: Connecting to 192.168.1.105:21...
    Status: Connection attempt failed with "ECONNREFUSED - Connection refused by server".
    Error: Could not connect to server

    I think that the only change that I made was adding the “rgc” user password so I decided to try deleting that user (sudo userdel rgc) to see if I could log in through Filezilla with that out of the way and using the “ray” super user password that had worked before. No luck.

    So once again I created the user “rgc” This time from the terminal.


    Code:
    sudo useradd -d /home/rgc -m rgc
      sudo passwd rgc
    I thought that I should check the line in the /etc/passwd file to make sure that nothing had changed. Still the same!

    Code:
    rgc:x:1001:1001:rgc,,,:/home/./rgc:/bin/bash
    For good luck restarted both apache2 and vsftpd.config

    And the final measure was to reboot the UBUNTU machine. Same results. Can’t access the files through Filezilla.

    And I was so very close!

    Now I am out of ideas again.

    You folks who can tolerate the lack of knowledge from newbies like me are saints. I really appreciate all the effort that you have contributed to helping me through this dilemma. For someone who knows there way around UBUNTU this is probably a no-brainer. I have learned a great deal through this process but would truly like to wrap this up and get on with the next chapter. Thanks again.

  3. #13
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: uploading files to LAMP on UBUNTU Desktop

    There was one initial mistake; you should not try to view /home/user/website1/www directly. Instead you should have tried 'the normal way' like http://localhost or http://192.168.1.105.

    Let's check if apache is still working locally and remotely. On your server, start a webbrowser and navigate to http://localhost; do you get the page that you expect. Next try http://192.168.1.105 directly on the server. And next try it from your 'other' machine with http://192.168.1.105.

    I don't know what's wrong with the ftp server; the first log to check is /var/log/vsftpd.log and see if it states why you can't connect. You might want to increase the verbosity of the log for this by adding the below line to vsftpd.conf (and next restarting the vsftpd server).

    Code:
    log_ftp_protocol=YES
    Next in a terminal run
    Code:
    sudo tail -f /var/log/vsftpd.log
    And from your remote machine connect and provide your credentials; it might be better if you use a command line ftp client (should be installed by default) so yu can see what happens step by step.

    Code:
    ftp 192.168.1.105
    I will post some samples just now
    If you don't make backups of your important data, your data is obviously not important to you.

  4. #14
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: uploading files to LAMP on UBUNTU Desktop

    Using a Windows ftp client (Linux will be the same) using an invalid user
    Code:
    C:\Users\wsturkenboom>ftp 172.31.208.129
    Connected to 172.31.208.129.
    220 (vsFTPd 2.2.2)
    User (172.31.208.129:(none)): abc
    331 Please specify the password.
    Password:
    530 Login incorrect.
    Login failed.
    ftp> bye
    221 Goodbye.
    The corresponding result in the vsftpd.log
    Code:
    Mon Oct 22 14:11:40 2012 [pid 2675] CONNECT: Client "172.31.208.36"
    Mon Oct 22 14:11:40 2012 [pid 2675] FTP response: Client "172.31.208.36", "220 (vsFTPd 2.2.2)"
    Mon Oct 22 14:11:43 2012 [pid 2675] FTP command: Client "172.31.208.36", "USER abc"
    Mon Oct 22 14:11:43 2012 [pid 2675] [abc] FTP response: Client "172.31.208.36", "331 Please specify the password."
    Mon Oct 22 14:11:45 2012 [pid 2675] [abc] FTP command: Client "172.31.208.36", "PASS <password>"
    Mon Oct 22 14:11:47 2012 [pid 2674] [abc] FAIL LOGIN: Client "172.31.208.36"
    Mon Oct 22 14:11:48 2012 [pid 2675] [abc] FTP response: Client "172.31.208.36", "530 Login incorrect."
    Mon Oct 22 14:11:53 2012 [pid 2675] FTP command: Client "172.31.208.36", "QUIT"
    Mon Oct 22 14:11:53 2012 [pid 2675] FTP response: Client "172.31.208.36", "221 Goodbye."
    Using a Windows ftp client (Linux will be the same) using a valid user
    Code:
    C:\Users\wsturkenboom>ftp 172.31.208.129
    Connected to 172.31.208.129.
    220 (vsFTPd 2.2.2)
    User (172.31.208.129:(none)): wim
    331 Please specify the password.
    Password:
    230 Login successful.
    ftp> bye
    221 Goodbye.
    The corresponding result in the vsftpd.log
    Code:
    Mon Oct 22 14:11:54 2012 [pid 2677] CONNECT: Client "172.31.208.36"
    Mon Oct 22 14:11:54 2012 [pid 2677] FTP response: Client "172.31.208.36", "220 (vsFTPd 2.2.2)"
    Mon Oct 22 14:11:56 2012 [pid 2677] FTP command: Client "172.31.208.36", "USER wim"
    Mon Oct 22 14:11:56 2012 [pid 2677] [wim] FTP response: Client "172.31.208.36", "331 Please specify the password."
    Mon Oct 22 14:12:00 2012 [pid 2677] [wim] FTP command: Client "172.31.208.36", "PASS <password>"
    Mon Oct 22 14:12:00 2012 [pid 2676] [wim] OK LOGIN: Client "172.31.208.36"
    Mon Oct 22 14:12:00 2012 [pid 2678] [wim] FTP response: Client "172.31.208.36", "230 Login successful."
    Mon Oct 22 14:12:08 2012 [pid 2678] [wim] FTP command: Client "172.31.208.36", "QUIT"
    Mon Oct 22 14:12:08 2012 [pid 2678] [wim] FTP response: Client "172.31.208.36", "221 Goodbye."
    Note: you can stop the tail by pressing <ctrl>C. And leave the ftp client by typing bye and pressing <enter> (as shown).

    PS
    Tested on a 10.04 system, not 12.04. But I don't expect differences (said the optimist )
    Last edited by Wim Sturkenboom; October 22nd, 2012 at 01:28 PM.
    If you don't make backups of your important data, your data is obviously not important to you.

  5. #15
    Join Date
    Oct 2012
    Beans
    16

    Re: uploading files to LAMP on UBUNTU Desktop

    Thanks for sticking with me on this.

    I can now again connect to the server using Filezilla and the “rgc” user and password. Hurray!

    It dawned on me that I may not have switched the ownership of the files back to “root” after making the changes. I have now made sure that the /etc/passwd, /etc/vsftpd.conf, and /etc/apache2/sites-available/default files are all owned by root. So now at least I think that I am back on more stable ground. My apologies for that oversight.

    Filezilla presents me with a root of “rgc” and a list of empty folders. Desktop, Documents, Downloads, Music, Pictures, Public, Templates, Videos and a file named examples.desktop. I can create a new folder, upload a file to it and change the name.

    However I still can’t find it from a remote browser.

    I am able to access phpmyadmim from the UBUNTU machine. I don’t recall noticing that there was a double “localhost” on the tab before, but there is obviously a great deal that eludes me.

    /localhost/localhost|phpmyadmin 3.4.10.1 deb 1

    http://localhost/phpmyadmin/index.ph...a99d50cec36d2a

    So it seems to me that the Apache server is working.

    Now if I could just find the files with my remote browser.

    I have tried everything in the path http://192.168.1.105/home/rgc/website1/www and always get 404’s.

    Thanks again. Your instructions are terrific and the detail helps me a great deal.

  6. #16
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: uploading files to LAMP on UBUNTU Desktop

    OK

    I made a mistake in my post #10; you need to modify /etc/apache/sites-available/default, not /etc/apache/sites-available/ (which is a directory). Did you try to make those changes?

    Assuming phpmyadmin was installed before post #10, the suggested changes to the apache configuration did not take effect or you did not make them. If the changes would have taken effect, phpadmin would have 'disappeared' from your browser.

    So I think apache is still looking at /var/www.

    Please post the output of
    Code:
    sudo ls -l /var/www
    I'm quite sure we'll find phpmyadmin in there; please confirm.

    And a little note on how apache works. It 'translates' a request for a webpage (e.g. http://localhost/index.html) to a request for a file on your server. In the original configuration, a request for http://localhost/somepage.html will be translated for a request for /var/www/somepage.html. And after the modification that I described, it would be translated to a request for /home/rgc/website1/www/somepage.html

    So there is no need (and it will not work) to do http://localhost/home/rgc/website1/www; it should just be http:/localhost to present the pages somewhere in your home directory.

    Note:
    after the changes you will loose phpmyadmin; a hurdle that we can take later. So don't panic And don't forget to restart apache2
    If you don't make backups of your important data, your data is obviously not important to you.

  7. #17
    Join Date
    Oct 2012
    Beans
    16

    Re: uploading files to LAMP on UBUNTU Desktop

    Eureka!

    The good news is that I am now able to find the files with the remote browser.

    The bad news is that I wasted a bunch of your time. Your directions were explicit, but inadvertently I managed to overlook a critical step in that I did not log out of the user “ray” and log in again as the user ”rgc” when I created the /website1/www folder.

    I’m not sure what I was thinking. Probably nothing at all or that it had something to do with the way that UBUNTU isolates each user. No common files available among users? Lesson learned. You gave me enough clues that thought that I had best do some investigative backtracking.

    I still evidently have some permission issues. I can view the two test type files that I copied from the /var/www folder and pasted into the rgc/website1/www folder but for some reason (permissions matter I expect) I get a “Forbidden - You don't have permission to access /index.html on this server.” on a file that I copied from my remote laptop using Filezilla.

    I renamed the original index.html file to index_orig.html and it still loads.

    If you have any advice as to what is going on here and help to deal with the phpmyadmin matter I think that I will be able to finally tag this as solved and sign off in deep gratitude. With your patience and help I have learned a lot about UBUNTU. As you have no doubt realized I am one of those folks who know just enough to be dangerous and a great deal of the appeal is enjoying the opportunity to work with people like you in the UBUNTU family.

  8. #18
    Join Date
    Oct 2012
    Beans
    16

    Re: uploading files to LAMP on UBUNTU Desktop

    I thought that the time had come to learn a bit about permissions and investigate the attributes of the files that would load;

    Owner – Read Write
    Group (rgc) – Read only
    Others – Read only

    The permissions of the files that would not load were:

    Owner – Read Write
    Group (rgc) - none
    Others – none

    I changed the permissions to 664 or ( - r w – r w – r - ) on these and was able to load them.

    Is there a method available that I could invoke so that I would not have to manually change the permissions on anything that I move into the /www folder while using Filezilla or Dreamweaver?

    Along with the new index file that I moved into the /www folder I also moved folders names “images” and “styles from the rest of the project.

    These folders permissions are ( d r w x - - - - - - - )

    And the files in them are ( – r w - - - - - - - )

    The /www folder is ( d r w x r w r – x ) (owner rgc)

    The /website1 folder is the same.

    My goal would be to be able to move/locate them on the Apache2 server and behave like they do on the Windows 7 laptop.

    Thanks - as always.

  9. #19
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: uploading files to LAMP on UBUNTU Desktop

    The permission settings for uploads are defined in the vsftpd.conf file
    Code:
    # Default umask for local users is 077. You may wish to change this to 022,
    # if your users expect that (022 is used by most other ftpd's)
    #local_umask=022
    Remove the '#' at the beginning of the red line so it's no longer treated as a comment and restart your vsftpd server. Note that the umask is the inverse of the permissions that you want (so 077 results in 700 and 022 results in 755).

    Directories created using ftp will now have drwxr-xr-x and files will have -rw-r--r--.

    That should round it up. I just like to make you aware of one little problem that you might encounter one day; apache will not be able to write in your directories; most users don't have a need for that, but if your web application includes e.g. an image upload facility for visitors, this will be an issue. I use a dedicated directory for it where apache has permission to write.

    I will add one more post to explain why I use /home/rgc/website1/www
    If you don't make backups of your important data, your data is obviously not important to you.

  10. #20
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: uploading files to LAMP on UBUNTU Desktop

    Note in advance
    I'm not trying to force you into any direction setting up your server. This just explains my approach.

    This is my setup on an intranet server
    Code:
    websites/
    |-- [drwxr-xr-x wim      users   ]  assetregister
    |   |-- [drwxr-xr-x wim      users   ]  inc
    |   `-- [drwxr-xr-x wim      users   ]  web
    |       `-- [drwxrwxr-x wim      users   ]  files
    ...
    ...
    ...
    |-- [drwxr-xr-x wim      users   ]  porepo
    |   |-- [drwxr-xr-x wim      users   ]  inc
    |   `-- [drwxr-xr-x wim      users   ]  web
    |       |-- [drwxrwxr-x wim      users   ]  files
    |       `-- [drwxr-xr-x wim      users   ]  images
    ...
    ...
    ...
    In my home directory, I have a subdirectory 'websites' that contain the different websites; shown above are two of them (assetregister and porepo).

    1)
    Each has a 'web' directory (yours was www) and an 'inc' directory. The 'web' directory is from what pages are served (the document root) by apache to the visitors of the website. The 'inc' directory is not accessible by visitors of the website but apache can read there.
    This allows to store files in there that contain secure information. I have e.g. a file connect.php in there with a function to connect to a mysql database that contains username and password. In a php page in the 'web' directory, I include that file and call that function.

    As the 'inc' directory is not accessible to the visitors, the login credentials for the mysql server are secure.

    The second purpose for this directory is to store files with php functions that can be re-used by different web pages on the site (write once, use often )

    2)
    In each 'web' directory I have a subdirectory 'files' where I allow apache to write.

    Code:
    wim@webserver:~/websites/porepo/web$ ls -ld files
    drwxrwxr-x+ 2 wim users 274432 2012-10-22 15:38 files/
    Looks quite normal and does not show that anybody but wim can write there. But note the + at the end of the permissions. This + shows when ACL (access control list) is used to set additional permissions.
    Code:
    wim@webserver:~/websites/porepo/web$ getfacl files
    # file: files
    # owner: wim
    # group: users
    user::rwx
    user:apache:rwx
    group::r-x
    mask::rwx
    other::r-x
    From this we can see all permissions and it is clear that the user apache can do everything in that directory.
    You can set those permissions using
    Code:
    setfacl -m u:apache:rwx files
    Note:
    This is a Slackware server and the webserver daemon (httpd) runs as the user apache; you need to check which user runs httpd on your system; it's probably www-data (but I'm not sure).


    Good luck
    If you don't make backups of your important data, your data is obviously not important to you.

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •