diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 34c807f1..bb18912e 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -278,7 +278,10 @@ pub fn start_server(mut os_input: Box, socket_path: PathBuf) { move || { drop(std::fs::remove_file(&socket_path)); let listener = LocalSocketListener::bind(&*socket_path).unwrap(); - set_permissions(&socket_path, 0o700).unwrap(); + // set the sticky bit to avoid the socket file being potentially cleaned up + // https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html states that for XDG_RUNTIME_DIR: + // "To ensure that your files are not removed, they should have their access time timestamp modified at least once every 6 hours of monotonic time or the 'sticky' bit should be set on the file. " + set_permissions(&socket_path, 0o1700).unwrap(); for stream in listener.incoming() { match stream { Ok(stream) => {