I am very new to Ubuntu and I still don't understand a lot of basic concepts so please bear with me.
I successfully installed XAMPP 1.7.4 in my ubuntu 11.04. The XAMPP is installed in /opt/lampp
. I know how to write php file in /opt/lampp/htdocs
using the bash terminal command sudo gedit /opt/lampp/htdocs/myphpfile.php
but what if I already have an existing php file inside a folder? Of course I don't want to write it again using sudo command. All I want to do is copy that folder that contains the php files inside htdocs
like I always do in Windows WAMP. Is there a command in which I could set the /opt
folder to writeable? Please help me.
You could always open up the file-browser (nautilus) as Arvind said by
gksudo nautilus /opt/lampp/htdocs
To expand on Will's answer (you can chmod)
This will change the ownership of the
/opt/lampp/htdocs/
to you:This will change the folder's permissions to be read, write and executed by you ONLY:
You can also use open nautilus (file browser) as root and type
This will open your file explorer. You can then go to the folder you want to copy the php files from and paste it into the htdocs folder.
Hope this helps! :)
Linux has tighter permission system, /opt folder is really an admin only area, and that's why it asked you password all the time. where windows just "assume" you are admin
To copy paste without
sudo
, you will need to use thechmod
to change the permission.I would recommend you type
man chmod
to read the manual there. try avoid777
.Beside You better make regular backup as there is no "re-cycle bin" in Linux. if you somehow overwrite a critical file with empty one, it's most likely gone forever.
You do not want to change ownership of /opt or even /opt/lampp. These directories are owned by root for a reason: security . If you go down the path of changing ownership of directories away from root, you are making your system less safe and may open yourself up to serious problems.
The best way to do what you're trying to do is to use a solution similar to what someone here already suggested: use the gksudo command. However, because it's tedious to constantly open a terminal to type the full command, create a shell (.sh) file instead.
1) Open a text editor (something like gedit, leafpad, kate, etc.) and type in the following:
2) Save the file on your Desktop as htdocs_open.sh
3) Open the terminal and type the following (this will change directories to the Desktop, where the above file, htdocs_open.sh, is saved.):
4) The type in the following (this will make your .sh file executable):
5) Close your terminal and then look for your file, htdocs_open.sh, on your desktop. Double click on it. A window will pop-up asking for your password. When you type it in the xampp htdocs folder will open along with root privileges.
Additional note! Since you are using Xampp on Linux, it might be convienient for you to also repeat the above steps using these codes:
To start Xampp:
To stop Xampp:
To open a text editor (gedit is used here) as root. This will allow you to save to the htdocs folder because opening gedit as root means you can save into the htdocs folder as root.
Remember! You will need to make the .sh file executable by running the chmod +x command.
I was having this problem myself, and then I realized I can do just one thing and everything will be flowers and roses every time from now on.
I opened nautilus. Then browsed to
/opt/lampp/htdocs
.Then I changed the
owner
andgroup
to myself, and then I provided the read and write privileges to everyone. However when I tried to do it for the files somehow it was returning back to-
instead ofRead and write
however. This worked. And now I can modify the files stored inhtdocs
.I used this:
But owner of every new created file/folder will be root.