sshfs: add -r and -M options

This commit is contained in:
aiju 2017-04-29 18:44:01 +00:00
parent b4b2cd72b0
commit ca2fa9596b
2 changed files with 22 additions and 4 deletions

View file

@ -4,7 +4,7 @@ sshfs - secure file transfer protocol client
.SH SYNOPSIS
.B sshfs
[
.B -abdRUG
.B -abdRUGM
]
[
.B -s
@ -15,6 +15,10 @@ sshfs - secure file transfer protocol client
.I mtpt
]
[
.B -r
.I root
]
[
.B -u
.I uidfile
]
@ -56,7 +60,10 @@ is specified,
.I sshfs
communicates with an SFTP server via stdin and stdout.
.PP
.I Sshfs
Unless
.B -M
is specified,
.I sshfs
will mount itself under the mountpoint specified by
.IR mtpt ,
or under
@ -73,6 +80,8 @@ and
.B -b
have the same function as they do with
.IR mount (1).
The default remote root is the user's home directory but can be changed with
.BR -r .
.PP
If
.B -s
@ -108,7 +117,7 @@ If these files cannot be accessed for any reason, numeric IDs simply remain untr
Further options:
.TP
-R
Read-only access only.
Read access only.
.TP
-d
Enable debugging output.
@ -125,6 +134,11 @@ In particular there is no guarantee that a failed
did not change some of the fields.
.PP
The code is naive about links and assumes files with distinct names to be distinct, assigning them different QIDs.
.PP
File names with null bytes in them will confuse
.I sshfs.
.I Sshfs
should probably escape them, as well as control characters that might confuse other software.
.SH HISTORY
.I
Sshfs

View file

@ -7,6 +7,7 @@
int readonly;
int debug;
char *root = ".";
#define dprint(...) if(debug) fprint(2, __VA_ARGS__)
#pragma varargck type "Σ" int
@ -732,7 +733,8 @@ sshfsattach(Req *r)
if(r->ifcall.aname != nil && *r->ifcall.aname != 0)
sf->fn = strdup(r->ifcall.aname);
else
sf->fn = strdup(".");
sf->fn = strdup(root);
root = ".";
sf->qid = (Qid){qidcalc(sf->fn), 0, QTDIR};
r->ofcall.qid = sf->qid;
r->fid->qid = sf->qid;
@ -1332,10 +1334,12 @@ threadmain(int argc, char **argv)
case 'a': mflag |= MAFTER; break;
case 'b': mflag |= MBEFORE; break;
case 'm': mtpt = EARGF(usage()); break;
case 'M': mtpt = nil; break;
case 'u': uidfile = EARGF(usage()); break;
case 'U': uidfile = nil; break;
case 'g': gidfile = EARGF(usage()); break;
case 'G': gidfile = nil; break;
case 'r': root = EARGF(usage()); break;
default: usage();
}ARGEND;