Comments (7)
When .u is used, the numerical uid takes precedence over the uname. I don't
think it makes sense to use the uname parameter in that case.
Original comment by [email protected]
on 5 Dec 2014 at 6:04
from go9p.
My primary use case is to make the 9p server listen on a domain socket, and
kernel-mount that socket.
So (the server has my patch, "golubovsky" is an existing user):
$ go-src/bin/ninepserver -addr=/tmp/socket -d=1 -proto=unix -root=.
Mount the socket using 9p2000.u
# mount -t 9p /tmp/socket /mnt/ -o trans=unix,version=9p2000.u,uname=golubovsky
2014/12/05 23:35:43 connected
2014/12/05 23:35:43 >>> @ Tversion tag 65535 msize 8192 version '9P2000.u'
2014/12/05 23:35:43 <<< @ Rversion tag 65535 msize 8192 version '9P2000.u'
2014/12/05 23:35:43 >>> @ Tattach tag 1 fid 0 afid 4294967295 uname
'golubovsky' nuname 4294967295 aname ''
2014/12/05 23:35:43 <<< @ Rattach tag 1 aqid (4835cc 1a44734e 'd')
2014/12/05 23:35:43 >>> @ Tstat tag 1 fid 0
2014/12/05 23:35:43 <<< @ Rstat tag 1 st ('.' 'golubovsky' 'none' 'none' q
(4835cc 1a44734e 'd') m d777 at 1417779905 mt 1417779901 l 4096 t 0 d 0 ext )
# mount -t 9p /tmp/socket /mnt/ -o trans=unix,version=9p2000.u,uname=nosuchuser
mount: wrong fs type, bad option, bad superblock on /tmp/socket,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
2014/12/05 23:36:23 connected
2014/12/05 23:36:23 >>> @ Tversion tag 65535 msize 8192 version '9P2000.u'
2014/12/05 23:36:23 <<< @ Rversion tag 65535 msize 8192 version '9P2000.u'
2014/12/05 23:36:23 >>> @ Tattach tag 1 fid 0 afid 4294967295 uname
'nosuchuser' nuname 4294967295 aname ''
2014/12/05 23:36:23 <<< @ Rerror tag 1 ename 'unknown user: 22' ecode 22
2014/12/05 23:36:23 disconnected
and mount fails.
Note that nuname = -1 in both cases simply because Linux kernel does not pass
UID to the 9p userspace program.
# mount -t 9p /tmp/socket /mnt/ -o trans=unix,version=9p2000,uname=golubovsky
2014/12/05 23:39:02 connected
2014/12/05 23:39:02 >>> @ Tversion tag 65535 msize 8192 version '9P2000'
2014/12/05 23:39:02 <<< @ Rversion tag 65535 msize 8192 version '9P2000'
2014/12/05 23:39:02 >>> @ Tattach tag 1 fid 0 afid 4294967295 uname
'golubovsky' nuname 4294967295 aname ''
2014/12/05 23:39:02 <<< @ Rattach tag 1 aqid (4835cc 1a44734e 'd')
2014/12/05 23:39:02 >>> @ Tstat tag 1 fid 0
2014/12/05 23:39:02 <<< @ Rstat tag 1 st ('.' 'golubovsky' 'golubovsky' 'none'
q (4835cc 1a44734e 'd') m d777 at 1417779905 mt 1417779901 l 4096 t 0 d 0 ext )
# mount -t 9p /tmp/socket /mnt/ -o trans=unix,version=9p2000,uname=nosuchuser
mount: Unknown error 526
2014/12/05 23:39:49 connected
2014/12/05 23:39:49 >>> @ Tversion tag 65535 msize 8192 version '9P2000'
2014/12/05 23:39:49 <<< @ Rversion tag 65535 msize 8192 version '9P2000'
2014/12/05 23:39:49 >>> @ Tattach tag 1 fid 0 afid 4294967295 uname
'nosuchuser' nuname 4294967295 aname ''
2014/12/05 23:39:49 <<< @ Rerror tag 1 ename 'unknown user: 22' ecode 0
2014/12/05 23:39:49 disconnected
mount fails again, but with different message.
This is Linux
# uname -a
Linux hpcompaq 3.13.0-40-generic #69-Ubuntu SMP Thu Nov 13 17:53:56 UTC 2014
x86_64 x86_64 x86_64 GNU/Linux
So, in both cases, at least with my patch, character user name is in use when
numeric lookup does not succeed. Without my patch 9p2000 would work but .u
would not. The reason why I don't want to use 9p2000 is that it also ignores
files' owner numeric IDs returning -1 for both user and group.
This is more like an issue with the logic of the kernel (which does not want to
deal with numeric UIDs). This makes sense though because if 9p connection is
made to a remote system, local numeric UIDs would not have any meaning on the
remote end. Character UIDs can be translated into numeric UIDs between the two
computers.
So my proposal is basically to add a fallback character username recognition to
9p2000.u if numeric UID fails to be recognized. If Linux kernel always passes
-1 for nuname, 9p2000.u would never work properly for kernel mounts.
Original comment by [email protected]
on 6 Dec 2014 at 4:59
from go9p.
I haven't checked the current kernel code, but at some point in the past, the
kernel used to pass numeric uid to the user-space 9p server, you just need to
make sure that your server supports the "nobody" (~0) uid too. Your server will
get multiple Tattach messages, each for any uid that accesses files on the
server.
Original comment by [email protected]
on 6 Dec 2014 at 5:31
from go9p.
So then 4294967295 in these messages is "inverted 32bit 0" however UID for
nobody at least on this Ubuntu instance is 65534. Maybe mount options
dfltuid/dfltgid will help, I'll check that. Would it make sense for Uid2User to
resolve to "nobody" for any numeric UID that cannot be mapped to username on
the current system?
Original comment by [email protected]
on 6 Dec 2014 at 2:54
from go9p.
The kernel doesn't have a way to know anything about what numerical value the
"nobody" user has. For that reason the 9p filesystem uses ~0 to make sure
anybody can attach to the server. In that sense, ~0 means more like "anybody",
than "nobody".
You can create your own implementations of the Users and Groups interfaces that
do anything you would like. I'd rather keep osUsers and osGroups the way they
are, because I am not sure if the changes won't break something else.
Original comment by [email protected]
on 6 Dec 2014 at 3:10
from go9p.
OK, thanks. Perhaps I understand it better now. I cannot change the status of
the issue myself, but I think you can close it.
Original comment by [email protected]
on 7 Dec 2014 at 2:07
from go9p.
Original comment by [email protected]
on 7 Dec 2014 at 8:18
- Changed state: WontFix
from go9p.
Related Issues (20)
- examples not working after implementing io.Reader/io.Writer HOT 1
- io.Copy: i/o count too large HOT 2
- ls.go Error "" HOT 3
- stats_http.go files built on default HOT 1
- Unregistreing a http handler HOT 1
- clonefs example: O_TRUNC not permitted HOT 1
- No unit tests HOT 1
- http package breaks multiple clients in one program HOT 5
- merge with russ and rob's code.google.com/p/goplan9?
- go9p does not compile on Plan 9 HOT 5
- Return value of FOpenOp.Open is ignored HOT 2
- No API to close the socket associated with a server HOT 2
- add dirread9p to srv
- add FWalk1Op and Clone interfaces for srv
- Unpack should uncondititionally initialize fc.Unamenum HOT 1
- Attaching using username instead of uid fails HOT 2
- no way to construct a File from a Fid HOT 3
- set Iounit when allocating auth fids HOT 1
- no seek method on clnt.File HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go9p.