Skip to content

Commit 3eaa8cd

Browse files
committed
Set permissions on root directories
1 parent b6d7904 commit 3eaa8cd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/drives/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class DriveManager extends EventEmitter {
4444
drive.writeFile('.key', drive.key.toString('hex'), err => {
4545
if (err) return reject(err)
4646
if (opts && opts.rootDrive) {
47-
drive.mkdir('/home', err => {
47+
drive.mkdir('/home', { uid: process.getuid(), gid: process.getgid() }, err => {
4848
if (err) return reject(err)
4949
return resolve(err)
5050
})

lib/fuse/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class FuseManager extends EventEmitter {
9797
if (!match.groups['key']) {
9898
if (op === 'readdir') return cb(0, [])
9999
if (op === 'releasedir') return cb(0)
100-
if (op === 'getattr') return cb(0, Stat.directory())
100+
if (op === 'getattr') return cb(0, Stat.directory({ uid: process.getuid(), gid: process.getgid()}))
101101
return handlers[op].apply(null, [...args, cb])
102102
}
103103

@@ -154,7 +154,7 @@ class FuseManager extends EventEmitter {
154154
handler: (op, match, args, cb) => {
155155
// If this is a stat on '/stats', return a directory stat.
156156
if (!match['key']) {
157-
if (op === 'getattr') return cb(0, Stat.directory())
157+
if (op === 'getattr') return cb(0, Stat.directory({ uid: process.getuid(), gid: process.getgid() }))
158158
return handlers[op].apply(null, [...args, cb])
159159
}
160160

@@ -171,7 +171,7 @@ class FuseManager extends EventEmitter {
171171
handler: (op, match, args, cb) => {
172172
// If this is a stat on '/active', return a directory stat.
173173
if (!match.groups['key']) {
174-
if (op === 'getattr') return cb(0, Stat.directory())
174+
if (op === 'getattr') return cb(0, Stat.directory({ uid: process.getuid(), gid: process.getgid() }))
175175
return handlers[op].apply(null, [...args, cb])
176176
}
177177

0 commit comments

Comments
 (0)