So I just created a website server on the pi following the guide in the raspberry pi user guide. Worked fine first time but I want to put the site i made in to the folder /var/www/... The only thing is, when I drag the files across I dont have permission. How do I copy a file from 1 place to another...... i know sudo but then what? Can I just disable this and make myself a root user? Its ridiculously frustrating...... Thank you.
Trevor Boultwood
How to copy files in to var.
4 posts
- Posts: 5
- Joined: Sun May 27, 2012 7:00 pm
- Code: Select all
sudo bash
passwd root
Set the root password to what you want.
Then you can login as root.
Don't use it with a gui and particularly surfing......
Don't judge Linux by the Pi.......
or...
issue a sudo su - command whilst logged in as pi
and then you just run as root from there on in
after that cp and cp -r are your friends
issue a sudo su - command whilst logged in as pi
and then you just run as root from there on in
after that cp and cp -r are your friends
Rather than logging in to root - if you really want a proper root session then I suggest you instead run an interactive sudo session
This won't help with your drag-and-drop problem though. You would instead need to run the file manager as root
Even if you try to "ignore" the security features of Linux they are likely to cause problems in future when you wonder why your webserver application can't read the directory that only root can access etc. - so far better to learn it properly.
To set the permissions correctly you should use chown and chmod to set the permissions.
For example if you'd like pi to own the /var/www directory then you would use:
To make sure everyone can read the directory
u = user (owner of the file / directory)
g = group
o = others (all other users)
r = read access
w = write access
x = execute permission (on a directory allows you to change to that directory)
So that everyone can write to the directory (not required normally, but helps remove the security barrier)
To take access away use - instead of +
You can also change the permissions of files and sub-directories using File manager - right click on a file or directory - choose properties and then the permissions tab. If you need to change permissions to files or directories that you don't own then that has to be done using root - either on the command line using sudo or through file manager started with gksudo.
I have created a tutorial on Linux file permissions.
- Code: Select all
sudo -s
This won't help with your drag-and-drop problem though. You would instead need to run the file manager as root
- Code: Select all
gksudo pcmanfm
Even if you try to "ignore" the security features of Linux they are likely to cause problems in future when you wonder why your webserver application can't read the directory that only root can access etc. - so far better to learn it properly.
To set the permissions correctly you should use chown and chmod to set the permissions.
For example if you'd like pi to own the /var/www directory then you would use:
- Code: Select all
sudo chown pi /var/www
To make sure everyone can read the directory
- Code: Select all
chmod ugo+rx /var/www
u = user (owner of the file / directory)
g = group
o = others (all other users)
r = read access
w = write access
x = execute permission (on a directory allows you to change to that directory)
So that everyone can write to the directory (not required normally, but helps remove the security barrier)
- Code: Select all
chmod ugo+rwx /var/www
To take access away use - instead of +
You can also change the permissions of files and sub-directories using File manager - right click on a file or directory - choose properties and then the permissions tab. If you need to change permissions to files or directories that you don't own then that has to be done using root - either on the command line using sudo or through file manager started with gksudo.
I have created a tutorial on Linux file permissions.