LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Transfering files to Ubuntu LAMP (https://www.linuxquestions.org/questions/linux-newbie-8/transfering-files-to-ubuntu-lamp-4175490023/)

olarsson 01-03-2014 01:00 PM

Transfering files to Ubuntu LAMP
 
I am a newbee at Linux. To learn more Linux I have installed an Ubuntu headless server with LAMP on a VM virtualbox.
I would like to transfer files to the www map on LAMP, to do this I have connected to the Ubuntu server with sftp
and the same username and password that I used when installing the Ubuntu server.

I have found the www map, but I can not transfer files to it, (so that I for example can replace the default index.html file).
I get the error message write: permission denied from my sftp program. Presumably I dont have the right write permissions to the folder.

Write permissions to the folder are drwxr_xr_x. "User" can both read and write. How could I not have the right permissions?
If I am not "user" who is "user"? How could it be that I am not permitted to write to the folder. What should I do to be able to transfer files to the www folder?

Thank you for any help

peonuser 01-03-2014 03:12 PM

Change to the web directory.
sudo scp -r yourusername@hostname:/wherefilesareonhost/filenames* .

You will have to type in the sudo password and the password on the host to log in.

olarsson 01-03-2014 10:06 PM

Quote:

Originally Posted by peonuser
Change to the web directory.
sudo scp -r yourusername@hostname:/wherefilesareonhost/filenames* .

You will have to type in the sudo password and the password on the host to log in.

Do you suggest that I should use SSH? Why does it not work the way I am doing it with sftp?

schneidz 01-04-2014 11:23 AM

The user you are using doesn't have privilege to change anything on the httpd server.
You need to act as root to be able to make those changes (sudo).

docbop 01-04-2014 03:28 PM

Well according to the permissions you posted, drwxr_xr_x. only the directory owner has write permissions. You didn't show the part with name of owner or group. So have to assume you aren't the own. In typical install the starting permissions are usually set to root. So you need to check who has permissions as well as the permissions themselves.

olarsson 01-06-2014 12:37 AM

Quote:

Originally Posted by docbop
Well according to the permissions you posted, drwxr_xr_x. only the directory owner has write permissions. You didn't show the part with name of owner or group. So have to assume you aren't the own. In typical install the starting permissions are usually set to root. So you need to check who has permissions as well as the permissions themselves.

Root owns of the www folder yes. I have learnt a little about the root account from here:

https://help.ubuntu.com/community/RootSudo

In Ubuntu root account is disabled to begin with. You have to enable it specifically to use it. Enabling root i generally not recommended because of security and stability of the system. It is instead recommended to use sudo command to get some of the
capabilities of root account.

It looks to me that enabling root is not the normal thing to do so what do you recommend me to do? Can I transfer ownership of
the map www, owned by root, from root to myself without self being root? Or do I have to enable root account for something as
simple as transferring a few files to the www folder? Can I use sftp to transfer the files?

I wonder one thing more: What type of account do I have when I log in with the user name and password that I installed with?
Obviously I am not root so what am? User with administrative rights?

evo2 01-06-2014 12:46 AM

Hi,

the simplest way would be to make /var/www writeable by your default user. One way to do this would be to make /var/www/ group writeable and put your user in that group. Eg assuming www-data exists, something like:
Code:

ssh defaultuser@server
sudo chown root:www-data /var/www
sudo chmod g+w /var/www
sudo usermod -Ga www-data defaultuser

Other options would depend on exactly what you want to copy to /var/www. Eg just one file or directory? Many files?

Evo2.


All times are GMT -5. The time now is 10:36 PM.