如何在没有 sudo 的情况下检查 fstab 文件是否正确?

如何在没有 sudo 的情况下检查 fstab 文件是否正确?

我从 saucy 更新到了 trusy。
之后,使用sudosegfaulted:

fkalter@London ~> sudo whoami
    [sudo] password for fkalter:
    YubiKey for `fkalter':
    [1]    16961 segmentation fault (core dumped)  sudo whoami

因此,当我尝试运行 strace 来获取更多信息时,输出中出现了以下内容:

sudo: effective uid is not 0, is"..., 140sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

我的/etc/fstab此时是这样的:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system>                             <mount point>   <type>  <options>                                   <dump>  <pass>
proc                                        /proc           proc    nodev,noexec,nosuid                         0       0
UUID=1afaad96-8aa3-4283-95a4-20510e5b3fbb   /               ext4    rw,async,exec,nouser,suid,errors=remount-ro 0       1
#UUID=1afaad96-8aa3-4283-95a4-20510e5b3fbb  /               ext4    defaults                                    0       1
UUID=46605028-51e4-4676-b621-2d8fbab185d5   /boot           ext4    defaults                                    0       2
UUID=8f6af894-fc4a-4a81-b1f7-20c42ef35fe0   /home           ext4    defaults                                    0       2

为了检查我的根文件系统是如何挂载的,我运行了以下命令,mount没有使用任何参数:

fkalter@London ~> mount
    /dev/sda6 on / type ext4 (rw)
    proc on /proc type proc (rw,noexec,nosuid,nodev)
    sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
    none on /sys/fs/cgroup type tmpfs (rw)
    none on /sys/fs/fuse/connections type fusectl (rw)
    none on /sys/kernel/debug type debugfs (rw)
    none on /sys/kernel/security type securityfs (rw)
    udev on /dev type devtmpfs (rw,mode=0755)
    devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
    tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
    none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
    none on /run/shm type tmpfs (rw,nosuid,nodev)
    none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
    none on /sys/fs/pstore type pstore (rw)
    cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,relatime,cpuset)
    cgroup on /sys/fs/cgroup/cpu type cgroup (rw,relatime,cpu,release_agent=/run/cgmanager/agents/cgm-release-agent.cpu)
    cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,relatime,cpuacct,release_agent=/run/cgmanager/agents/cgm-release-agent.cpuacct)
    cgroup on /sys/fs/cgroup/memory type cgroup (rw,relatime,memory,release_agent=/run/cgmanager/agents/cgm-release-agent.memory)
    cgroup on /sys/fs/cgroup/devices type cgroup (rw,relatime,devices,release_agent=/run/cgmanager/agents/cgm-release-agent.devices)
    cgroup on /sys/fs/cgroup/freezer type cgroup (rw,relatime,freezer,release_agent=/run/cgmanager/agents/cgm-release-agent.freezer)
    cgroup on /sys/fs/cgroup/blkio type cgroup (rw,relatime,blkio,release_agent=/run/cgmanager/agents/cgm-release-agent.blkio)
    cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,relatime,perf_event,release_agent=/run/cgmanager/agents/cgm-release-agent.perf_event)
    cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,relatime,hugetlb,release_agent=/run/cgmanager/agents/cgm-release-agent.hugetlb)
    /dev/sdf1 on /mnt/secret type ext4 (rw)
    /dev/sda1 on /boot type ext4 (rw)
    /dev/sda5 on /home type ext4 (rw)
    binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
    systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
    /home/fkalter/.Private on /home/fkalter type ecryptfs (ecryptfs_check_dev_ruid,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs,ecryptfs_sig=153b19c1d2ccc61f,ecryptfs_fnek_sig=03fd342dfcc3e207)
    gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=fkalter)

第一行显示唯一的选项是 rw(读/写)。没有 suid,也没有我在 fstab 中指定的任何其他选项。要查看启动过程中发生的情况,请查看 dmesg 的输出。

fkalter@London ~> dmesg | grep mount
    [    4.445090] EXT4-fs (sda6): mounted filesystem with ordered data mode. Opts: (null)
    [    7.767086] EXT4-fs (sda6): re-mounted. Opts: (null)
    [    7.833123] EXT4-fs (sdf1): mounted filesystem with ordered data mode. Opts: (null)
    [    7.842508] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
    [    7.855840] EXT4-fs (sda5): mounted filesystem with ordered data mode. Opts: (null)

如果我正确执行此操作,则也不会显示任何安装选项。

我怀疑我的 fstab 文件有问题(权限、拼写错误等)。在谷歌上搜索时,唯一的答案似乎是sudo mount -a。最后我的问题是这个。如何在没有 sudo 的情况下检查这一点?

相关内容