BambooFileUtils
@Deprecated public class FilePermissionUtil extends Object
The only supported method in this version is setting "600" mode for a file
chmodUserPrivate(java.io.File)
Modifier and Type | Method and Description |
---|---|
static void |
chmodUserPrivate(File file)
Deprecated.
Changes the mode of the file to 600, as required for example by the ssh key files.
|
public static void chmodUserPrivate(File file) throws IOException, InterruptedException
It tries to first invoke Java 1.6 {link}File#setWritable{link} and family using reflection. If it's unavailable, it tries to invoke chmod executable - be aware it will fail on windows unless you have cygwin or similar installed.
Please note that this method is not guaranteed to have done what it's asked - it may fail to change the permission and there is no way for you to know.
file
- the file to change permissions onIOException
- when chmod process execution fails - not thrown when using reflectionInterruptedException
- when process.waitFor(chmod) is interrupted - not thrown when using reflectionRuntimeException
- when the reflection call on JDK1.6 fails (might be caused by SecurityException)Copyright © 2017 Atlassian Software Systems Pty Ltd. All rights reserved.
View cookie preferences