diff options
author | aiju <devnull@localhost> | 2017-04-29 18:44:01 +0000 |
---|---|---|
committer | aiju <devnull@localhost> | 2017-04-29 18:44:01 +0000 |
commit | ca2fa9596b5d0d893be28c6e8fd8a52a89a0c3c6 (patch) | |
tree | 4b927da233a228a07de990f1b12334da9fd2929d /sys | |
parent | b4b2cd72b0e674300e5ec0030967621a05049c35 (diff) |
sshfs: add -r and -M options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/man/4/sshfs | 20 | ||||
-rw-r--r-- | sys/src/cmd/sshfs.c | 6 |
2 files changed, 22 insertions, 4 deletions
diff --git a/sys/man/4/sshfs b/sys/man/4/sshfs index 5165b3740..6e5d82efa 100644 --- a/sys/man/4/sshfs +++ b/sys/man/4/sshfs @@ -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 diff --git a/sys/src/cmd/sshfs.c b/sys/src/cmd/sshfs.c index eaa32cb9d..d8687900f 100644 --- a/sys/src/cmd/sshfs.c +++ b/sys/src/cmd/sshfs.c @@ -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; |