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...

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".

  • 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

  • Getting "Save File" permission message related to Report Generation Toolkit

    I started having this problem about a month ago.  It does not affect the operation of my project but is a minor nuisance, but a nuisance none the less.  I opened a couple of Excel Specific VIs.  I did not nor did I attempt to make any changes, I was just curious as to their content (truth is I wanted to see how the active X controls were being used).  Ever since then I get the attached messages when saving my project and have not been able to get rid of it.  When OK is pressed, a Save As dialog box appears (see attached) pointing to the NI directory which contains the Excel VIs for the Report Generation Toolkit.  I press cancel and am able to save my project VIs just fine, but I would like to get to the bottom of this problem.
    I would not think that simply opening a VI would cause this behavior.  I should also mention, it not only attempts to save the VIs I opened, but every RGT VI that is a part of my project, which is even stranger.  I have not attempted a reinstall.  I was hoping for something a little less drastic, and that won't prevent this from happening again, unless I can kill my curiousity that is. Is there a setting somewhere which I am missing?  Thanks in advance for your assistance.
    Reese
    Reese, (former CLAD, future CLD)
    Some people call me the Space Cowboy!
    Some call me the gangster of love.
    Some people call me MoReese!
    ...I'm right here baby, right here, right here, right here at home
    Attachments:
    Save Message.JPG ‏249 KB
    Save As Dialog box.JPG ‏305 KB

    It did not work.  In fact, it called out four bad VIs (see attached).  But I think this is probably normal behavior.  All the VIs in question are broken due to an unwired input on the bundle.  The bundle is the only thing in these VIs.  Could you please verify that this is the case.  It said the mass compile was complete and I am assuming that it did compile the rest of the VIs, correct?  Unfortunately I am still getting the same message.  Do you have any other ideas?  Anyone?  Thanks again for your assistance.
    Reese, (former CLAD, future CLD)
    Some people call me the Space Cowboy!
    Some call me the gangster of love.
    Some people call me MoReese!
    ...I'm right here baby, right here, right here, right here at home
    Attachments:
    Mass Compile Dialog.JPG ‏338 KB

  • 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

  • HT1941 I have inadvertently changed a file permission setting. When opening Aperture I get the following; Aperture cannot access this library. To use this library make sure it's file permissions are set correctly. I am an old dude new to Mac OS. What up?

    I have inadvertently changed a file permission setting. When opening Aperture I get the following; "Aperture cannot access this library. To use this library make sure it's file permissions are set correctly". I am an old dude new to Mac OS. Looked in settings but have no idea how to allow file sharing to myself. I have been using Aperture actively for 6 weeks. I'm the only one using this Mac. What up?

    Back up all data now.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. If none of this is meaningful to you, you don't need to worry about it.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. You can demote it back to standard status when this step has been completed.
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Drag or copy — do not type — the following line into the Terminal window, then press return:
    sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -R $UID:20 ~ $_ ; chmod -R -N ~ $_ 2> /dev/null
    Be sure to select the whole line by triple-clicking anywhere in it. You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. You don't need to post the warning. If you don’t have a login password, you’ll need to set one before you can run the command.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2
    Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the OS X Utilities screen appears, select Utilities ▹ Terminal from the menu bar. A text window opens.
    In the Terminal window, type this:
    resetpassword
    That's one word with no spaces. Then press return. A Reset Password window opens. You’re not going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select  ▹ Restart from the menu bar.

  • 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

  • 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

  • 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.)

  • [GUIDE] How to get MapleStory working in Arch Linux

    MapleStory is a free-of-charge, 2D, side-scrolling massively multiplayer online role-playing game developed by the South Korean company Wizet. Several versions of the game are available for specific countries or regions, and each is published by various companies such as Wizet and Nexon. Although playing the game is free, character appearances and gameplay enhancements can be purchased from the "Cash Shop" using real money. MapleStory has a combined total of over 50 million subscriber accounts in all of its versions. MapleStory North America (Global), for players mainly in North America and outside of East Asia, Southeast Asia and Europe, has over three million players.
    In the game, players travel the "Maple World", defeating monsters and developing their characters' skills and abilities as is typical in role-playing games. Players can interact with others in many ways, such as through chatting, trading, and playing minigames. Groups of players can band together in parties to hunt monsters and share the rewards. Players can also join a guild to interact more easily with each other.
    I am an avid mapler myself, however, I am also an avid archer! For some time, I have wanted to get MapleStory working on Arch Linux in some way, but nothing seemed to work. As you might have guessed by now, recently, while playing around with VirtualBox, I discovered a method to get MapleStory working on it! Though in this method you won't actually have MapleStory running on Arch Linux, you'll have it running on a VirtualBox Windows virtual machine, that is still pretty good compared to other people's experiences.
    I hope there are at least a few maplers on this forum, and if there aren't, I hope that someone will port this post over to other Linux, or even MapleStory, forums. Anyways, let's begin.
    1. Download and install a version of Virtual Box that is version 3.0+. The reason for this is that, only versions 3.0+ support an experimental DirectX Driver with 3D acceleration that is required for MapleStory to run.
    2. Create a Windows Virtual Machine, add a hard disk to it, and install and update Windows on it(preferably Windows XP, as it uses less resources than other contemporary Windows installations).
    3. Once you have done all you needed and wanted on that Windows installation, restart it, boot it into safe mode by holding F8 at the boot, and wait until the desktop is fully loaded.
    4. After you are at the desktop, go to "Devices" at the top of the menu of the Windows virtual machine, and select "Install Guest Additions...". Wait until Guest Additions finishes installing, and when VirtualBox asks you if you want to mount the disk containing the Guest Additions on the virtual machine, say "Yes".
    5. Run the main executable on the disk that doesn't have amd64 or x86 following its name. Follow the instructions it gives you, and when it asks you what components to install, make sure both of the boxes it shows you are checked.
    6. After the install is completed, the virtual machine will restart. After it restarts, shut it down.
    7. Congratulations! You now have DirectX installed on your VirtualBox virtual machine! Now you need to activate the "3D Acceleration", that enables it.
    8. In the VirtualBox main window, make sure you have your machine with Windows selected. Then, click on "Machine", and then "Settings...", at the top. A new window should pop up. On the left hand side, click on the display panel, and in the new settings section, tick Enable 3D Acceleration. Click "OK", to save the settings.
    9. Start your Windows virtual machine, install MapleStory just as you would on a normal windows computer, and run MapleStory.
    Notes: This way of running MapleStory is slower than by running it normally, on a normal windows computer. Also, try to not interact with your Linux desktop while playing MapleStory, because this can cause HackShield to shut down MapleStory, due to the fact that it believes there is a hacking attempt.
    If any of you port this guide to any other place on the web, please, credit me, neovaysburd5.
    For any further questions or inquiries, this goes to all of you, please contact me at [email protected].
    Last edited by neovaysburd5 (2009-08-19 16:51:31)

    Alright, I've posted it in the wiki. I don't know if it meets the Arch Linux wiki standards, so if there is absolutely anything wrong with it, please fix it right away. Don't even ask my permission.
    http://wiki.archlinux.org/index.php/MapleStory

  • File permission in Users/Shared?

    I Got Info from the Finder on the Users/Shared folder, unlocked the permissions with my password, and set Everyone to read-write then click on Apply to Enclosed Items down in the hidden menu at the bottom [is that a gear icon?]
    I did the same to the subfolder then did the same to my pages document.
    I used Disk Utility to Repair Permissions...
    I used Terminal to "ls -ld" and "ls -l" then "chmod uog+rw" the folders and files The folders are all rwxrwxrwx and the files are all rw-rw-rw- as expected.
    Yet when I switch users Pages still won't save the file? I have to duplicate it, save it, delete the old one, and ping pong back and forth.
    If the Finder will let me delete a file I don't own by prompting me to enter the admin password, why can't pages do the same if it things I don't have permission, ask for the admin password and fix it?
    There are lots of tips on this but I can't get the file to be read-write for both users? What should I do? Do I need to add both usernames specifically because the Everyone group isn't really for everyone? It is just the two accounts my admin account and one normal user so we can collaborate on the file while sharing this machine.
    It looks like a .pages "file" is really a bundle in a subdirectory as far as the terminal is concerned. Do I need some fancy Unix recursive chmod command?
    Using OSX 10.9.2 and Pages 5.1.1769
    I would expect this level of frustration from Windows 8.1 as we say good bye to the Windows XP machines at the office, everyone should buy a mac, right?

    Try looking at the permissions of your iTunes folder. I have just tried sharing my library to multiple users on my MBP. This will allow you to all users to buy songs and share them too. I must admit I haven't yet chosen this library for addtional users

  • 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

  • Can't remove or modify mystery exec file

    I'm running 10.4.9 on a 3-yr-old G5. A couple items in the trash won't budge; both are now exec files, though they didn't start out that way. One originally was a text file, the other was a directory; I don't know how/why they were transformed. I'm not sure if this is relevant, but I've been using a new thumb drive to transfer files (these and many others) among my computers.
    The following steps have been unsuccessful at removing these folders from the Trash:
    Finder: empty trash/secure empty trash; changing permissions; renaming the files (produces a new file in the trash that is removable, but the original remains).
    Terminal: rm, chmod, mv commands (they have no effect; the file just sits there).
    Two questions: (1) How do I remove the files from the trash? (2) Why/how did the originals get changed to exec files?
    thanks,
    Richard
    G5 tower Mac OS X (10.4.9)
    1.4 GHz iBook

    Thanks for the suggestions (and the link to the helpful XLab site), but nothing worked. Your suggestion of creating a new file with the same name resulted in Trash with two separate but identically named files (a bit disconcerting); I could delete the new one but not the problem executable file. The sudo route, including all the recommendations from XLab (and from the OSXFAQ site linked therein) didn't work, either. I am listed as owner of these files, and they're in my .Trashes/501 folder, but ! they ! won't ! die!
    Any other ideas?
    Also, anyone know why/how my originals were transformed into executable files?

  • Getting remote file using FTP Server Issue in OSB

    Hi Guys,
    I have configured a FTP server on my local system and I created a proxy service to get file from ftp location to some other location but it fails . I used ftp protocol for getting file
    and my ftp location is D:\host\ftp and it has another folder called osb . I used ftp as protocol and EndPointURI is ftp://localhost/. It fails to get files and shows error message like
    com.bea.wli.sb.transports.TransportException: <user:osb>Unable to list files for
    directory: .
    at com.bea.wli.sb.transports.ftp.connector.FTPWorkPartitioningAgent.exec
    ute(FTPWorkPartitioningAgent.java:218)
    In case of Business Service, writing a file to ftp location (i.e ftp://localhost/ means D:\host\ftp\osb) working.
    I used service account for both proxy,BS to connect . osb is username and same as password.
    Can Any one please suggest me How to solve this issue?
    Thanks,
    Srinivas.
    Edited by: 863597 on May 22, 2012 1:06 AM

    Hi Vijay Thank you,
    Can we do the pooling directly using FTP protocol like JMS protocol in OSB with out using FTP JCA Adapter.I did in such a way but it fails. For pooling files the mentioned endpoint uri is as ftp://localhost/ and it actual path is D:\host\ftp and ftp has another folder called osb here i have to get the files from this osb Can any one suggest me if there is any problem with the ftp protocol end point.
    Thank You,
    Srinivas.

  • Using Photoshop CC I cannot save images to folder from Camera Raw as Tif. I get message 'write permission error'. I am using Widows 7 Professional.

    I have just changed to Photoshop CC from CS4 and cannot now save images from Camera Raw. I get message 'write permission error'. I assume there is some permissions setting which did not exist with CS4.
    I cannot progress unless I revert to CS4. What am I failing to do?

    See if the suggestions, here, help, although this was back with CS6-cloud, not CC, so may not apply 100%:
    http://forums.adobe.com/message/4758115
    I'd suggest that rather than deleting the file, you move it out of the folder to somewhere else, in case things get worse and you need to put it back.
    I found this by Googling the error message. 
    If you can't figure it out, you might post in the "Downloading, Installing and Set Up" or "Adobe Creative Cloud" forums  since it seems to be related to the Cloud updates, and not necessarily ACR plug-in functionality, and I've seen India support people actually tackle problems posted there, which rarely happens in the ACR forum, although an ACR engineer may sometimes pop in to answer questions, they'd be less likely to know how to fix deployment issues.

Maybe you are looking for

  • Best practice using TFS 2013 to report on developer time

    Here is my issue: Last year, I stood up a TFS instance for myself since I was the only developer in IT.  Since then we have created a new application development department and pulled in devs who were previously working in other departments outside o

  • Function module for Change Master (CC01) creation

    Hi all, Pl. tell me function module or BAPI for 'Change Master' Creation. It is linked with BOM to record BOM changes. Its Tcode is 'CC01'. Pl. reply. Regards, Darshana

  • Link to WSDL

    Hi, When defining an webservice i go to the Integration Directory and calls the function Tools->Define Web Service and the i get an WSDL which i can download and send to somebody. But is there no option for the developers to call a link where they ca

  • Apple Pay: The last 4 digits of my device account number is not showing up on my phone.

    My credit card company needs the last 4 digits of my device account number, and only ***** (stars) show up under my divice account number.  I have 8.1 installed, and have tried restarting my phone.  Any suggestions on how to get my divice account num

  • How do i label a photo?

    I'd like to add some kind of description at the bottom of photos but can't seem to find anything under the iPhoto Help menu.