FAQ
Hi -

I’m stumped on the following problem: I’m creating a FSDataOutputStream with some permissions, write to it, close it, and low and behold the permissions don’t seem to be what I set!!

Here is the whole program and its output:

Configuration xconf = new Configuration();
int numDataNodes = 1;
boolean formatNameNode = true;
String[] racks = null;
MiniDFSCluster xdfsCluster = new MiniDFSCluster(xconf, numDataNodes, formatNameNode, racks);
FileSystem xfs = xdfsCluster.getFileSystem();

FsPermission permissions = new FsPermission("750");
FSDataOutputStream out = xfs.create(new Path("test-file.txt"), permissions, true, 1024, (short)1, 1024, null);
out.writeUTF("hello");
out.close();

System.out.println("permissions= " + xfs.getFileStatus(new Path("test-file.txt")).getPermission());

Output:

permissions= rw-r-----

Frank

Search Discussions

  • Harsh J at Oct 10, 2011 at 6:02 pm
    Frank,

    HDFS does not have the concept of the executable permissions (+x) in
    it for files. 750 is effectively 640 on HDFS, and that is exactly what
    you're getting there.
    On Mon, Oct 10, 2011 at 11:11 PM, Frank Astier wrote:
    Hi -

    I’m stumped on the following problem: I’m creating a FSDataOutputStream with some permissions, write to it, close it, and low and behold the permissions don’t seem to be what I set!!

    Here is the whole program and its output:

    Configuration xconf = new Configuration();
    int numDataNodes = 1;
    boolean formatNameNode = true;
    String[] racks = null;
    MiniDFSCluster xdfsCluster = new MiniDFSCluster(xconf, numDataNodes, formatNameNode, racks);
    FileSystem xfs = xdfsCluster.getFileSystem();

    FsPermission permissions = new FsPermission("750");
    FSDataOutputStream out = xfs.create(new Path("test-file.txt"), permissions, true, 1024, (short)1, 1024, null);
    out.writeUTF("hello");
    out.close();

    System.out.println("permissions= " + xfs.getFileStatus(new Path("test-file.txt")).getPermission());

    Output:

    permissions= rw-r-----

    Frank


    --
    Harsh J

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommon-user @
categorieshadoop
postedOct 10, '11 at 5:42p
activeOct 10, '11 at 6:02p
posts2
users2
websitehadoop.apache.org...
irc#hadoop

2 users in discussion

Harsh J: 1 post Frank Astier: 1 post

People

Translate

site design / logo © 2022 Grokbase