hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Astier <fast...@yahoo-inc.com>
Subject Permissions when creating a file
Date Mon, 10 Oct 2011 17:41:09 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message