LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-07-2015, 09:37 AM   #1
gliesian66
LQ Newbie
 
Registered: Nov 2015
Posts: 1

Rep: Reputation: Disabled
Can't write to /opt through Java...


(two questions)

This works fine on windows and Linux...

Files.createDirectories(Paths.get(/tmp/dir_name));

This does not:

Files.createDirectories(Paths.get(/opt/dir_name));

(1) Why?

What I do after this point is create user folders where they can upload files to.

(2) Is there a better more preferred place on Linux for this?

Thanks,
Robert
 
Old 11-07-2015, 09:49 AM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Hi,
Welcome to the forum. I hope this will be the one stop for all your questions on Linux...
You (or your program) may not have the rights to write in that folder...
Quote:
What I do after this point is create user folders where they can upload files to.
The prefered option may be to create a user and use the created folder/space as upload point...basically, this is what FTP does...
Unless there is a detail not yet mentioned here...
Melissa

Last edited by ButterflyMelissa; 11-07-2015 at 10:38 AM.
 
Old 11-07-2015, 09:55 AM   #3
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
You can't write to /opt/ because it requires root permission to do so. That is because it is for the installing of optional applications (from outside of the distribution's repositories, for example) and not normal user data.
For specific users their files should be under /home/username otherwise you could perhaps create a folder under /var/, make it user writeable then put files there -- others may have better suggestions as to where to create the folder but /opt/ is not the right location.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell getopts: opt w/ optional parameter is taking next opt as its parameter! GrapefruiTgirl Programming 22 10-27-2010 06:00 AM
Regarding # /opt/CTEact/bin/act & /opt/SUNWexplo/bin/explorer not available for x86 rajaniyer123 Solaris / OpenSolaris 6 04-24-2008 09:09 AM
Can not write to file in Java irfanhab Programming 7 12-05-2005 12:01 AM
java does not install in opt but install in usr bbmak Linux - Software 6 10-02-2005 11:13 PM
java io write file dummyagain Programming 3 02-23-2005 04:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration