more /usr/local/etc/mtools.conf
# Example mtools.conf files. Uncomment the lines which correspond to
# your architecture and comment out the "SAMPLE FILE" line below
#
# A note on permissions: a user must have read and
# write permissions for the devices named here in
# order to access the DOS file systems. You might
# give ALL USERS access to ALL FLOPPY DISKS via
#the command
#
# chmod a+rw /dev/*fd* /dev/rfd[0-9]*
#
# # FreeBSD floppy drives
drive a: file="/dev/rfd0"
drive b: file="/dev/rfd1"
看来我们需要让所有的用户都有访问软驱的权限;幸运的是,指出FreeBSD软驱设备的那些行已经为我们去掉了注释,所以我们无需对此配置文件作任何更改。
现在看一下/dev/rfd0的权限情况,因为它被mtools看作是“A:”:
ls -l /dev/rfd0
crw-r----- 18 root operator 9, 0 Oct 3 08:51 /dev/rfd0
看来这就是问题所在。因为mtools.conf规定,用户需要rw读写权限来访问该设备,但现在用户只有r读。由于该文件属于root,我们必需成为超级用户才能更改它的权限;因为我只有一个软驱,所以就对这个设备加入了rw权限:
su
Password:
chmod a+rw /dev/rfd0
ls -l /dev/rfd0
crw-rw-rw- 18 root operator 9, 0 Oct 3 08:51 /dev/rfd0
离开超级用户账号并以普通用户身份再试一下mdir命令;你应该可以看到软盘上的内容了。
让我们再假设一些东西。我在自己的硬盘的起始部分有一个FAT分区;让我们来看一下mtools是否能访问它。在mtools.conf中有一些行是关于硬盘的:
more /usr/local/etc/mtools.conf
# IDE hard disks
# first disk on the first IDE
# interface (wd0) slice 1 (s1)
drive c: file="/dev/rwd0s1"
由于我使用的FreeBSD版本高于4.0,所以其第一个IDE接口实际称为ad0而不是wd0了。这样我需要变为超级用户并编辑一下刚才读到的行:
drive c: file="/dev/rad0s1"
^
当现在是超级用户时,我还要检查一下该设备的权限情况:
ls -l /dev/rad0s1
crw-r----- 1 root operator 116, 0x00020002 Oct 4 15:58 rad0s1
并更改一下以使用户可以访问C:盘:
chmod a+rw /dev/rad0s1
然后,作为一个普通用户,来看一五我是否能访问A:盘和C:盘上的数据:
mcd a:
mdir
Volume in drive A has no label
Volume Serial Number is 3505-18E3
Directory for A:/
dru3 txt 2846 11-28-2000 21:46
inetdc~1 txt 13669 10-05-2000 21:22 inetd.conf.txt
cisco doc 10752 11-13-2000 18:07
3 files 27 267 bytes
1 428 698 bytes free
mcd c:
mdir
Volume in drive C has no label
Volume Serial Number is 39D0-A67B
Directory for C:/
bootsect bsd 512 10-04-2000 15:22
confer~1 11-01-2000 20:39 conferencing server
sybex 11-10-2000 20:18 Sybex
3 files 512 bytes
492 470 272 bytes free
现在,我知道在我的C:盘上有一些隐藏文件;如果看一下man dir的话,会知道-a开关能显示隐藏文件。让我们再试一下:
mdir -a
Volume in drive C has no label
Volume Serial Number is 39D0-A67B
Directory for C:/
bootsect dos 512 10-04-2000 15:33
config sys 0 10-04-2000 15:40
autoexec bat 0 10-04-2000 15:40
io sys 0 10-04-2000 15:40
msdos sys 0 10-04-2000 15:40
bootsect bsd 512 10-04-2000 15:22
| 论坛热门帖子: | [lch203] 写得蛮好的linux学习笔记(10-21) [黑马制造] 学习java的30个目标(10-19) [笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19) [udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18) [沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18) |
| TAG标签: | 文件 系统 访问 如何 用户 一个 可以 软盘 如果 mtools |
注册
个人空间
