微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – 创建没有mount的虚拟软盘映像?

有很多帖子要显示,以创建一个虚拟的软盘映像文件作为超级用户用户可以运行sudo命令.基本步骤是:

>通过dd命令创建空的1.44MB映像文件
>通过mkfs.msdos格式化图像文件
>将图像文件安装到某个安装点
>将东西复制到安装点
> umount虚拟软盘映像文件

我的问题是,如果我只是一个普通用户谁不能运行sudo命令,我该如何遵循上述步骤来创建一个虚拟的软盘映像和写一些东西?

非常感谢.

解决方法

是的,当然可以这样做.对于ext2文件系统,使用mtools作为FAT和e2tools或genext2fs.
$dd if=/dev/zero of=/tmp/disk1.img count=1440 bs=1k 
1440+0 records in
1440+0 records out
1474560 bytes (1.5 MB) copied,0.00569719 s,259 MB/s

$/sbin/mkfs.msdos /tmp/disk1.img 
mkfs.msdos 3.0.12 (29 Oct 2011)

$mdir -i /tmp/disk1.img
 Volume in drive : has no label
 Volume Serial Number is 9913-BFF6
Directory for ::/

No files
                          1 457 664 bytes free

$mcopy -i /tmp/disk1.img /etc/issue.net ::/
$mdir -i /tmp/disk1.img
 Volume in drive : has no label
 Volume Serial Number is 9913-BFF6
Directory for ::/

issue    net        28 2012-06-26  10:49 
        1 file                   28 bytes
                          1 457 152 bytes free

当然,我没有根本的权利.

原文地址:https://www.jb51.cc/linux/393537.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐