Seting file permission in Linux

hello everybody!
I wrote a program in java and swing gui instalator, which creating bash scrfipt file to lauch the jar file. I have question: how to set exec permission for the new created file. I wrote in my program:
if("Linux".equals(System.getProperty("os.name"))) {
               FilePermission fPerm = new FilePermission(path, "execute");
What should I do next, to set permission.

FilePermission is for use within the SecurityManager. You will need to actually invoke the linux command chmod using Process.exec

Similar Messages

  • How to use FilePermission class to change the file permission in Linux

    Hi all,
    I'm running in a issue related to changing the file permission under Linux environment. I'm using Suse 10.0 Linux and run jdk 1.5 java runtime.
    I want to create a file during execution time and change the permission of the same. I use File.createNewFile() API to create file. By default it does not have all the 3 permission (read,write,execute) for all the user ( user,owner,group). Through program I have to change the file permission ( equal to execute ,chmod 777 filename).I donot want to use runtime.exec() with chmod as the argument , since it creates a process to change the permission which may impact the performance. I want to try FilePermission class , by giving filename and permission as the argument. But it is not changing the permission . Could any one faced this problem ?
    If any body guides me, how to change the permission of the file under Linux using FilePermission class , it would be helpful.
    Thanks,
    Sankar

    How do I set the Umask prior to starting the program
    ? Could pls explain in steps.I don't think umask can help you. The mode mask prevents permission bits from being set when a file is created, but does not force any bits to be set. So if execute permission is not set explicitly when a file is created, umask will do nothing about it.
    But if you want more information about umask, see the man page for your shell script (sh, csh, etc.) or "man 2 umask".

  • Getting exec file permission on Linux

    Hi,
    I have read http://forum.java.sun.com/thread.jspa?forumID=256&threadID=302708, but this is the old stuff.
    My problem is as follows: I need to sftp-y file from one Linux account to the other Linux one. It is not a big deal. However, I would like to preserve file permission of the copied file. Particularly, I am interested in preserving 'x' (exec) permissions. (java.io.FilePermission are silent about 'exec' permission).
    The solutions to this problem I can see are the following:
    1. I can give all sftp-ied files 'x' permission even if the original file has no 'x' permission
    2. I can 'exec("ls -l ") and parse it.
    However, I do not like these solutions. I would like to check file permissions on the local host and then 'chmod' of the sftp-ied file. And I would like to do it without parsing any 'ls -l'-like command. Do you have some clues how to do this?
    Thanks

    But this class allows to grant permissions.
    The actions to be granted are passed to the
    constructor in a string containing a list of one or
    more comma-separated keywords. The possible keywords
    are "read", "write", "execute", and "delete".
    I would like to get the permission of a given
    file.Sorry. I'm quite sure I saw something the like of this coming in a new release, but am not able to find it again. When I saw "FilePermissions", I assumed it was that.
    ... Ah, now I found it. It's a mustang thing, so it's of no help.
    http://java.sun.com/developer/technicalArticles/J2SE/Desktop/mustang/enhancements/
    The weird thing is this quote:
    The methods of determining whether a file is readable, writable, or executable
    remain from the previous version of this platform, Java 2 Platform,
    Standard Edition (J2SE) 5.0.
         public boolean canRead();
         public boolean canWrite();
         public boolean canExecute();But there's no "canExecute()" method in the [url http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html]1.5 docs...

  • File permission error; NI-488: DMA hardware error detected

    I'm running LabVIEW 8.0 on the latest supported SUSE linux. My vi saves a data file. If I save a file named "/home/bill/LabVIEW/data/file.dat," it saves okay the first time. But then if I run the program again, it gives me an error instead of just writing over file.dat (which is what I want it to do).
    Error 8 occurred at Open/Create/Replace File in filename.vi
    Possible reason(s):
    LabVIEW: File permission error.
    NI-488: DMA hardware error detected.
    Also, I don't know if this is related, but when I click on the folder icon to the right of the file path on the front panel, and navigate to the directory mentioned above, then type "file.dat," I get the message "/home/bill/LabVIEW/data/file.dat does not exist." Shouldn't this *create* the new file?
    Thanks,
    Bill

    You should really start your own thread describing your problem in detail. One of the issues here is that there are two possible sources for the error code 8. Which one is applicable to you? What platform are you on? What version of LV? What are you trying to accomplish? What exactly triggers the error?
    Please start again with your own thread and with the answers the questions I asked (as well as anything else that you think might be of value).
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Unable to open USB port device file: Permission denied

    I have an up-to-date system (full "pacman -Syu" yesterday), I am in a "lp" group and the printer (Canon Pixma MP270) started to give "Unable to open USB port device file: Permission denied" error, although in the past it worked and still works in Windows. Doesn't anybody have a similar problem?

    Thanks for reply.
    CUPS worked, I could use CUPS-PDF and localhost:631 was accessible and working.
    Today I managed to print again. I did "pacman -Rcsn cups" and reinstalled it again.
    My printer is Canon Pixma MP270 and so far it wasn't the best choice for Arch Linux—scanning works fine but it's like throwing a coin when it comes to printing. I've written a simple PKGBUILD for installing its printing driver as a regular package, but I don't know what to set as a license.
    pkgname=mp270-printer
    pkgver=3.20
    pkgrel=1
    pkgdesc="Canon Pixma MP270 printer driver"
    arch=('i686')
    url="http://software.canon-europe.com/products/0010753.asp"
    license=('unknown')
    depends=('libpng12' 'gtk2' 'popt')
    makedepends=('deb2targz')
    source=(http://files.canon-europe.com/files/soft37268/software/MP270_debian_driver_pack.tar)
    md5sums=('d26c36e2d1799ddc09e644dc7765f0a3')
    build() {
    cd $srcdir
    tar xzf cnijfilter-mp270series-$pkgver-1-i386-deb.tar.gz
    cd cnijfilter-mp270series-$pkgver-1-i386-deb/packages
    deb2targz *
    tar xzf cnijfilter-common_$pkgver-1_i386.tar.gz
    tar xzf cnijfilter-mp270series_$pkgver-1_i386.tar.gz
    ln -s /usr/lib/libtiff.so usr/lib/libtiff.so.4
    package () {
    cd $srcdir/cnijfilter-mp270series-$pkgver-1-i386-deb/packages
    cp -r usr $pkgdir/

  • Error 8 (file permission​s) when using Help:Searc​h

    Hi there,
    When I use the help system and do a search, I get the following error:
    Error 8 occurred at Open File
    Possible reason(s):
    LabVIEW:  File permission error. You do not have the correct permissions for the file.
    =========================
    NI-488:  DMA hardware error detected.
    This is Labview 8.2 running on Linux (Enterprise RHEL4), and I had the same problem with Labview 7.1.  The problem seems to be caused by the permissions on some or all of the following files, which are written to the /tmp directory when the search is performed:
    controls2.htm 
    index2.htm 
    js_buttons.htm 
    search_results.html
    If I do a search, these files are written but not erased (with permissions -rw-r--r--).  If someone else then does a search, they get the Error 8 problem listed above.  If the owner of these files (or root) deletes them, the problem is solved -- until a different user than the owner of those temporary files wants to search the help system.
    My guess is that if I could get Labview to either open up the write permissions on these files or delete them after the help session is complete, the problem would be solved.
    Any advice?  Has anyone else had this problem (you would need a multiple-user linux system to see it)?
    Thanks,
    Tobin

    Hi Tobin-
    The following KnowledgeBase articles provide some valuable insight.  Check them out and reply if they don't help resolve the problem.
    KB 3GFF9FBP: Why do I get "Error 8 Occurred at Open File" When Writing to or Reading From a File?
    KB ...
    And there are lots of discussions about this already.  For other possible causes/solutions, try searching the forums for "file permission error 8".
    Drew Pierce | District Manager, Central Texas | National Instruments

  • File permission when upload the file on HP-UX

    hello,
    There is noe program is written to upload file from local machine to unix/linux server at location /app/test/.
    Both directory has rights 777. owner of the test directory is lets "xyz"
    Now written program upload file as "xyz" user at location /apps/test/.
    The file permission of uploaded file if -rw-r-----
    Now my problem is - i want file permission -rw-r--r--
    I cant give rights manually everytime with chmod command.
    Is there any other way to change file permission of uploaded files????
    output of umask of "xyz" user is 000
    The same code is working properly on linux but i m getting different file permission on HP UX
    Thank you....

    Multipart request is not handled as www request.
    UploadBean might help you :
    http://www.javazoom.net/jzservlets/uploadbean/uploadbean.html

  • Web-Disk on OSX 10.9 Give me this error: "Finder got an error: Network file permission error."

    Previously I was using OSX 10.8 and Web Disk was working great.
    Since I upgraded to OSX 10.9 Web Disk Dont Attach to my compputer and give me this ERROR:
    FInder got an error: Network file permission error.
    When I got this ERROR first time I searched GOOGLE and found this link: http://cammodude.blogspot.no/
    And I did:
    To force all connections to be SMB1:
    Open A terminal window
    paste in the following line followed by the return key(should be all on one line): 
    echo "[default]" >> ~/Library/Preferences/nsmb.conf; echo "smb_neg=smb1_only" >> ~/Library/Preferences/nsmb.conf
    What the command does:
    Creates a file called nsmb.conf  in your  home directory at the path ~/Library/Preferences/nsmb.conf.
    Adds directives to force SMB connections to use the SMB1 protocol.  This is slower but stable.
    Then I could use Web Disk on OSX 10.9 after executing this command in Terminal.
    But now I restarted my Macbook and now Im NOT able to connect to Web Disk and get the same ERROR.
    FInder got an error: Network file permission error
    After trying 100 times it attaches 1 time but then show this ERROR:
    Can't get <<class cdis>> "my.server.com/2078" of application "Finder".
    If this happen then I can see the files in Finder and see the Contents and Size of files but if I open a PHP file in BBEdit then it shows BLANK.. But actually it is NOT blank.
    Now Im stuck How can I solve this? All help is highly appericated..
    Thank you so much...

    Hi,
    Make sure to chmod the app, something like this :
    chmod -Rf 777  secure_site_WebDisk.app
    (in my case the CPanel provided the app for my OSx version.)

  • There has been a network or file permission error. The network connection..

    hello,
    there has been a network or file permission error. The network connection may be lost.
    this is the error my client gets sometimes when he wants to save a word document.
    when i go in the finder i have no problem accessing that network share, and when i look up the file and check the permissions there is no reason why this error should occure.
    situation :
    1 os 10.3.9 server
    7 os 10.5.5 clients
    1 os 10.3.9 client
    office 2004 for mac (version 11.50)
    there are 2 10.5.5 clients (emacs) with this problem on a regular base (3-5 times a week). One imac 17" 10.5.5 has this once a month.
    it is a wired cat5 network.
    any idea what could cause this problem?
    thanks
    Marco

    I found a logical explanation on the following site : http://www.makemacwork.com/office-2004-wont-save-to-server.htm , I am gonna try the steps they describe and post back the result.
    Marco

  • Error 8 File permission error while building executable for a RT

    I got error 8 File permission error while building executable for a RT. It happened always after build, I mean new startup.rtexe and startup.alias files have been created. At the build properties, it was set use default .alias file.
    I had the executable built successfully at one time.
    The detail message is:
    Visit the Request Support page at ni.com/ask to learn more about resolving this problem. Use the following information as a reference:
    Error 8 occurred at Open/Create/Replace File in RTBEP_Generate_Deploy_Instructions.vi->RTBEP_Invoke_Build_Engine.vi->RTBUIP_Build_Invoke.vi->RTBUIP_Build_Rule_Editor.vi->RTBUIP_Open_Properties.vi->RTBUIP_Item_OnDoProperties.vi->RTBUIP_Item_OnDoProperties.vi.ProxyCaller
    Possible reason(s):
    LabVIEW:  File permission error. You do not have the correct permissions for the file.
    =========================
    NI-488:  DMA hardware error detected.
    I checked relevant posts, couldn't find any clue.
    Please give me some ideas.
    Thanks.

    Hi Ya-hoo,
    Error building application in LabView 8.0 seems to describe a similar situation. The .alias file is important, as described in that discussion forum.
    Cheers.
    | Michael K | Project Manager | LabVIEW R&D | National Instruments |

  • Workflow to change file permission in SharePoint Online Document Library

    1.What are my options with SPD 2013 If I want to change a documents file permission in a workflow?
    2.Where does SPO host 2013 Workfows?
    3.If connecting to SPO Can I use Worklow Manager 1.0?
    4.Will I need to host my Workflow Manager workflows on server or Azure if running against o365/SPO?
    5.If I wish to create SPO 2013 workflows with Visual Studio 2012, what do I need and will I be limited to actions I see in SPD 2013?
    ============================
    Thank You
    cyberpine.com

    You can host this workflow as a SharePoint App in SharePoint Online or use SharePoint Designer to create this workflow as long as you use the app step. Managing the permissions can be done with a REST call.  The initiator of the workflow must have
    been granted the right to "Manage Permissions" and the app must have full control of the Site Collection.   We have done so for several of our clients.   I know you asked this question some time ago, but I thought the info might still be helpful.

  • File permission error in LabVIEW, but what file?

    I am in the process of smoothing out the wrinkles in a large LabVIEW program that I've converted from LV 7.0 to LV 2011SP1.  I've also moved from WinXP to Windows 7.  I get why there are file permission errors and I understand what the issues are in regard to moving from XP to 7.  What I would really like, is for the error message to tell me WHAT file is having the issue.  There are entirely too many file accesses in this program, I am not the originator, and it's been painful.  A more explicit error message, a log file, or some other cool trick to find what file is having the issue would be super.  While I'm asking for stuff, a call stack or at least the name of the VI this code calls would be wonderful, as nothing at all calls New File directly.
    Certified LabVIEW Developer
    NI-VLM Administrator

    How are you currently handling the error?  The file you tried to access should be part of the string in the error cluster.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to set file permission using Oracle FTP Adapter

    Hi,
    I am using Oracle SOA Suite 11.1.1.4. I am trying to put a file using Oracle FTP adapter on unix box. The file that gets written to target system has file permission as RW/R/R. But this is a legacy system, and for them to consume this file - they expect the file permission to be RW/RW/R.
    They have set the .profile with the required permissions for the ftp user account that we are using. But still when my BPEL process writes a file to unix box through ftp adapter, the file permission is RW/R/R.
    Is there any way to control file permissions while writing files using ftp adapter? Any help would be highly appreciated.

    907597 wrote:
    But these setting needs to be done on unix server. Yes, that's the way to go... There's no config for that on FtpAdapter as far as I know...
    This setting will enable the same configurations for all other ftp accounts on the server, which doesnt sound correct. Any other way of doing this? Or can this be done only for one ftp account?You have to check if your ftp server is capable of having different umask for different ftp users... I believe most do not...
    http://h30499.www3.hp.com/t5/System-Administration/Setting-FTP-umask-per-user/td-p/2590101#.UMZ0TeEe7ng
    Cheers,
    Vlad

  • Changing oracle file permission with ftp / sql

    Hi, i have a question:
    I've configure webdav to browse my /i folder.
    I can use as well filezilla, connecting with hostname / uname: system / pass / myoraclesystem pass.
    Is there a way to change file permission attributes with ftp?
    Thank you

    Hi,
    Check out ORDSYS.ORDImage type from Oracle Intermedia, and especially its "process" method.
    It possesses various commands to change image properties.
    HTH.

  • How to work with file system in linux within a JSF app?

    I use this line in my backing bean to log some events:
    FileHandler fhxml = new FileHandler("../webapps/MyWebApp/Log/MyWebAppLog.xml", append);
    fhxml.setFormatter(new XMLFormatter());That works fine in windows but when I deploy it in my Tomcat 6 in linux It doesn't work. How can I work with file system in linux?

    You should never use relative paths to access the filesystem. The path would be relative to the current working directory which is not per se the same in all environments. To convert a relative web path to an absolute file system path, you need ServletContext#getRealPath(). Use this absolute file system path in the java.io stuff. In a JSF application on top of Servlet API you can get the underlying ServletContext by ExternalContext#getContext().
    Alternatively, if the file is located in one of the default paths of the classpath or if its path is added to the classpath, you can also just use ExternalContext#getResource() or even #getResourceAsStream() using just the file name.

Maybe you are looking for

  • Video displays a "Scrolling Torn Picture" every 15 - 20 seconds

    On all downloaded TV shows or Movies, every 15 to 20 seconds the video (picture) does what I can only describe as a "scrolling rip or tear" in which the picture displays a line across the screen that separates the picture slightly and starts at the b

  • Check in migo while gr raw material should equal with the challan materials

    hi friends, while doing gr in migo there should be a check for  the raw material's which we are giving should match with challan materials. Here challan no is entered at the excise invoice tab- subcontracting challan level. points will be rewarded, t

  • Help with importing Movies

    I downloaded a music video in ipod format and I cant get it to import into iTunes. I tried all I could think of, any suggestions?

  • Error when compressing domain file

    This is probably a rare one, but I'll give it a shot anyway. I just recently started getting an error message stating +"An error occurred adding "" to the archive"+ when compressing an iWeb domain file. Long story short, I pass this file back and for

  • GB e-filling functionality

    Hi, We are trying to implement the GB e-filing functionality. We have SAP ECC 600 and as middleware we have the Business Connector 4.8. SAP states that with our ECC 600 we should use the XI connector. We are trying to get an alternative to this solut