3

I am running springsource framework in ubuntu 10.01. In my home folder, I have installed springsource IDE. I have my tomcat6 appserver in the /usr/share/tomcat6. While executing a sample project springapp, I have created the springapp dir in /users/share/tomcat6/webapps/ folder using sudo as I am unable to do it directly.

On running the ant deploy or ant deploywar command, I am unable to copy the sample file -index.jsp from my workspace in springsource IDE to springapp dir in /usr/share/tomcat6/webapps as I am getting the error permission denied while copying the .jsp file.

Can anybody please provide suggestion as to how to overcome this issue?

Regards

Jorge Castro
  • 71,754

2 Answers2

8

You do not own the files, neither do you have the permission to write to /usr/share/tomcat6/webapps. The following command will change the ownership of the webapps folder and files recursively to yourusername. That enables user yourusername to write to that directory.

sudo chown -R yourusername /usr/share/tomcat6/webapps
Lekensteyn
  • 174,277
  • Awesome, that command worked. I was having issues adding brushes to GIMP. THANKS A BUNCH! –  Feb 19 '11 at 01:16
  • I'm lost :( Why should we do such a thing? My concern is the usr/shared/lazarus folder but I already have files there. So if I don't have permissions how did the other files get there? I also tried gksudo nautilus to paste some folders in it but it gives the same error. – itsols Oct 17 '13 at 14:30
  • @itsols Perhaps those have been installed by the package manager? Check with dpkg -S /usr/shar/tomcat6/webapps – Lekensteyn Oct 17 '13 at 14:56
  • Ok, you're right. The other files came in through the installation (package manager). But doesn't using sudo nautilus give me super user privileges? – itsols Oct 18 '13 at 02:05
  • @itsols See http://askubuntu.com/q/11760/6969 – Lekensteyn Oct 18 '13 at 09:07
2

To temporarily upgrade rights to copy a file using terminal, 'sudo cp file1 file2' to copy file as a superuser (i.e. root). Another option is to use 'gksudo nautilus' to upgrade rights and invoke the GUI file manager. These upgraded rights are revoked when you exit terminal.

This is a user or group rights issue if you need to copy to this directory all the time. 'sudo chgrp' or 'sudo chown' to update rights to the directory.

The intention is to never log in as root on a production machine and use the aforementioned user or group commands instead. Use care exposing your development/learning environment to the internet.

Bret
  • 66
  • 'sudo cp file1 file2' is neat. I usually need to upload files using WinSCP to a ubuntu server to some application directory I almost have permission problems like this. Now I can upload to my home directory, then sudo cp the file to any destination. – dnang Jun 16 '15 at 10:02