diff --git a/navigator/components/NavWindow.js b/navigator/components/NavWindow.js index 6b3d7d3..cddf5e6 100644 --- a/navigator/components/NavWindow.js +++ b/navigator/components/NavWindow.js @@ -498,6 +498,9 @@ export class NavWindow { } async mkdir() { + let current_user; + var user_promise = cockpit.user(); + user_promise.then(user => current_user = user.name); let response = await this.modal_prompt.prompt("Creating Directory", { new_name: { @@ -519,14 +522,23 @@ export class NavWindow { } var promise = new Promise((resolve, reject) => { var proc = cockpit.spawn( - ["mkdir", this.pwd().path_str() + "/" + new_dir_name], - {superuser: "try", err: "out"} + ["runuser", "-u", current_user, "mkdir", this.pwd().path_str() + "/" + new_dir_name], + {superuser: "require", err: "out"} ); proc.done((data) => { resolve(); }); proc.fail((e, data) => { - reject(data); + var proc2 = cockpit.spawn( + ["mkdir", this.pwd().path_str() + "/" + new_dir_name], + {superuser: "try", err: "out"} + ); + proc2.done((data) => { + resolve(); + }); + proc2.fail((e, data) => { + reject(data); + }) }); }); try {