AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[nfs](server)

Martin Hope
AdvApp
Asked: 2024-03-29 04:37:03 +0800 CST

NFS:写入/创建权限?

  • 5

我已经使用 NFS 设置了服务器和客户端(均为 LinuxMint 21.3),以便客户端具有读写访问权限。但是读取成功但无法写入。我在这里和其他地方搜索了很多问题,但没有看到任何似乎明确提供解决方案的内容。我浏览过此页面,确认了我所做的事情。

这是设置:

服务器/etc/exports设置为读/写:

/exports  192.168.0.0/28(rw,no_subtree_check)

客户端/etc/fstab设置为在启动时挂载:

media:/exports /mnt/nfs/media-server  nfs      auto,noatime,defaults,x-gvfs-show    0       0

服务器导出的权限(本示例仅选择一个目录):

root@media:~# ls -al /exports/Software
total 16
drwxr-xr-x 4 root root 4096 Mar 28 11:56 .
drwxr-xr-x 8 root root 4096 Mar 28 11:55 ..
drwxr-xr-x 2 root root 4096 Mar 28 11:56 Linux
drwxr-xr-x 2 root root 4096 Mar 28 11:56 Windows

客户端挂载权限:

root@brawn:~# ls -al /mnt/nfs/media-server/Software
total 16
drwxr-xr-x 4 root root 4096 Mar 28 11:56 .
drwxr-xr-x 8 root root 4096 Mar 28 11:55 ..
drwxr-xr-x 2 root root 4096 Mar 28 11:56 Linux
drwxr-xr-x 2 root root 4096 Mar 28 11:56 Windows

但是尝试从客户端复制到服务器——或者从客户端在服务器上创建文件夹——失败。

尝试以我的用户身份进行复制(在两个系统上具有相同的 uid、gid)

:~$ cp /media/<user>/Storage/Software/Linux/zoom*.deb /mnt/nfs/media-server/Software/Linux
cp: cannot create regular file '/mnt/nfs/media-server/Software/Linux/zoom_amd64.deb': Permission denied

即使以 root 身份尝试也失败:

:~# cp /media/<user>/Storage/Software/Linux/zoom_amd64.deb /mnt/nfs/media-server/Software/Linux
cp: cannot create regular file '/mnt/nfs/media-server/Software/Linux/zoom_amd64.deb': Permission denied

更新

使用 @vidarlo 的答案中提供的信息,我执行了以下操作:

在服务器上:

sudo groupadd -g 1003 nfsshare
sudo usermod -a -G nfsshare <user>
cd /exports
sudo chgrp -R nfsshare /exports
sudo chmod -R 775 /exports
sudo exportfs -ar

在客户端:

sudo groupadd -g 1003 nfsshare
sudo usermod -a -G nfsshare <user>
mount -a

我的用户现在可以完全访问导出的内容。

nfs
  • 1 个回答
  • 67 Views
Martin Hope
user2294468
Asked: 2024-03-04 21:12:24 +0800 CST

NFSv4 恢复过程是否需要共享 /var/lib/nfs?

  • 7

正如我从 NFSv4 恢复过程中了解到的,客户端还保存状态,并且可以在 NFS 服务器崩溃时帮助重建 NFS 状态。我正在尝试使用 drbd 构建主动-被动 NFS HA。我是否仍需要在 NFS 服务器之间共享 drbd 上的 /var/lib/nfs/ 文件夹?

我尝试了一个简单的设置。一个 NFS 客户端和两个 NFS 服务器。即使不共享文件夹,NFS 客户端也能够启动恢复过程,并且在宽限期结束后,NFS 服务器和 NFS 客户端能够执行 IO。

nfs
  • 1 个回答
  • 36 Views
Martin Hope
mandg
Asked: 2024-01-05 06:02:12 +0800 CST

NFS 映射禁用帐户

  • 5

Linux(未加入 AD)是否关心映射的 NFS 用户帐户是否在 Active Directory 中被禁用?

例如,我有一个 AD 用户帐户在 NFS 中映射到 Linux 挂载点。当我在 AD 中禁用该用户帐户时,一切仍然有效。当然,当我在 AD 中删除同一个用户帐户时,访问会失败。

NFS访问Linux挂载点是否只与UID映射有关(与AD中的账户状态无关)?

nfs
  • 1 个回答
  • 91 Views
Martin Hope
user1359448
Asked: 2023-09-23 00:41:18 +0800 CST

NetBSD 9.3 - NFS 设置 /etc/exports

  • 6

我正在尝试设置 NFS,但在 /etc/exports 方面遇到了一些问题

当我的 /etc/exports 文件的内容是这样的时:

/data1 192.168.1.213(rw)

我从 showmount -e 192.168.1.245 得到这个

client$ showmount -e 192.168.1.245
Exports list on 192.168.1.245:
client$

但是当我的 /etc/exports 文件中有这个时:

/data1 -alldirs -network 192.168.1.245 -mask 255.255.255.0
/data2 -alldirs -network 192.168.1.245 -mask 255.255.255.0

从这里: https: //www.netbsd.org/docs/guide/en/chap-net-services.html

我从 showmount -e 192.168.1.245 得到这个

client$ showmount -e 192.168.1.245
Exports list on 192.168.1.245:
/data2                             192.168.1.245 
/data1                             192.168.1.245

我可以在我的客户端计算机(也是 NetBSD 9.3)上安装 data1 和 data2,但当我尝试复制文件、mkdir 等时,权限被拒绝

阅读此内容: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_file_systems/exporting-nfs-shares_managing-file-systems 我知道这是 /etc/exports 的一般格式:

export host(options)

我想要实现的是:网络上的每台机器(192.168.1.*)无论用户连接什么都可以挂载我的服务器(192.168.1.245)上提供的具有读写权限的任何挂载点NFS

阅读 RedHat 文档,我了解到它是这样的:

/data1 host(rw,all_squash,anonuid=1000,anongid=100)

gid 和 uid 设置为与我的名为 user (非 root)的用户匹配

但我不知道从这里该做什么。

更新 接受的答案解决了问题,我现在面临权限问题:NetBSD 9.3 - NFS Permissions

nfs
  • 1 个回答
  • 71 Views
Martin Hope
David
Asked: 2023-02-21 03:26:51 +0800 CST

NFS 服务器未在启动时启动(可以手动启动)

  • 5

问题:我有一个 NFS 服务器无法在启动时导出目录。启动后,我可以通过 ssh 登录并手动启动服务器。我已将所有 owner:group 和权限设置为非常“宽松”,以避免任何权限问题,当我解决问题时,这些将在稍后锁定。

注意:无法从我的局域网外部访问此服务器。

systemctl status nfs-kernel-server.service 的输出

● nfs-server.service - NFS server and services
   Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2023-02-20 10:22:36 GMT; 27min ago
  Process: 303 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=1/FAILURE)

Feb 20 10:22:36 file-server systemd[1]: Starting NFS server and services...
Feb 20 10:22:36 file-server exportfs[303]: exportfs: Failed to stat /shared/Documents: No such file or directory
Feb 20 10:22:36 file-server exportfs[303]: exportfs: Failed to stat /shared/Downloads: No such file or directory
Feb 20 10:22:36 file-server exportfs[303]: exportfs: Failed to stat /shared/Video: No such file or directory
Feb 20 10:22:36 file-server systemd[1]: nfs-server.service: Control process exited, code=exited status=1
Feb 20 10:22:36 file-server systemd[1]: Failed to start NFS server and services.
Feb 20 10:22:36 file-server systemd[1]: nfs-server.service: Unit entered failed state.
Feb 20 10:22:36 file-server systemd[1]: nfs-server.service: Failed with result 'exit-code'.

在我运行 systemctl start nfs-kernel-server.service 之后

systemctl status nfs-kernel-server.service 的输出

● nfs-server.service - NFS server and services
   Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
   Active: active (exited) since Mon 2023-02-20 10:51:34 GMT; 1min 4s ago
  Process: 735 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 732 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 735 (code=exited, status=0/SUCCESS)

Feb 20 10:51:33 file-server systemd[1]: Starting NFS server and services...
Feb 20 10:51:34 file-server systemd[1]: Started NFS server and services.

所以我可以手动启动该服务,但它不会在开机时启动。

服务器信息:

IP 地址 - 192.168.1.200(由 DHCP 分配,在路由器上保留 IP)

sda ext4 在启动时挂载为 / 和 swap

sdb ext4 在启动时挂载为 /shared

/etc/fstab

#sda1
UUID=4c5189b4-6ed8-416a-9b45-d7a8cb7d1f76 /               ext4    errors=remount-ro 0       1
#sda2
UUID=85704cdf-46ff-4a71-83a0-deebf37f9f82 none            swap    sw              0       0

#sdb1
UUID=98c91985-fe1b-43d0-8c62-a6edb9184a35 /shared ext4 nofail,sync,auto,noexec,nosuid,rw,nouser 1 2

/etc/出口

/shared/Video 192.168.1.0/24(rw,sync,no_subtree_check)
/shared/Downloads 192.168.1.0/24(rw,sync,no_subtree_check)
/shared/Documents 192.168.1.0/24(rw,sync,no_subtree_check)

安装点的所有者/权限(/共享)

drwxrwxrwx 7 nobody nogroup 4096 Aug 18  2022 /shared/

/shared/* 的所有者/权限

drwxrwxrwx  27 nobody nogroup 12288 Jan 26 19:45 /shared/Documents/
drwxrwxrwx  25 nobody nogroup  4096 Aug 18  2022 /shared/Downloads/
drwx------   2 root   root    16384 Aug 18  2022 /shared/lost+found/
drwxrwxrwx 162 nobody nogroup 12288 Feb  4 15:03 /shared/Video/

(显然 lost+found 不是共享的。所有者:组和权限是递归设置的)

我可以提供所要求的任何其他信息。

nfs
  • 1 个回答
  • 38 Views
Martin Hope
Richard T
Asked: 2022-10-06 14:38:40 +0800 CST

在其他内部系统上完美运行的防火墙系统上安装 NFS 安装点时遇到问题:如何找到原因?

  • 0

这是在 Fedora Core 35 上:这个环境已经成熟,并且有一些称为防火墙或网关的系统,我们第一次希望对其中一个系统进行 NFS 共享。

在客户端上的挂载出现问题后,我通过使用 /etc/fstab 条目的复制粘贴在不同的内部系统上进行相同的挂载来证明服务器的配置很好。我认为这一定是防火墙问题,所以我将接口更改为“受信任”区域。但我仍然得到:

mount.nfs: access denied by server while mounting 192.168.1.1:/fu

所以,我做了一些研究并想出办法:

rpcdebug -m nfsd -s all

但是我没有得到任何与所讨论的坐骑相关的信息——事实上,什么都没有进入/var/log/messages……这不是我应该看的地方吗?!(其他与 nfs 相关的项目都在那里,但不是这个挂载。)

所以,我尝试了我们的备份服务器并得到了相同的(空)结果。而且我还尝试从使用主机名和使用客户端上的 IP 地址进行更改 - 无论哪种方式,结果都相同,除了我报告的内容。)

nfs
  • 2 个回答
  • 38 Views
Martin Hope
Raul Chiarella
Asked: 2022-04-14 13:33:28 +0800 CST

仅当存在 Samba 挂载时才绑定挂载?(例如:BIND MOUNT 需要 NFS 挂载 \\172.16.xx\files...)

  • 1

我在 fstab 中使用以下内容安装了 SAMBA:

//source/files /mnt/files cifs user,_netdev,cache=none,credentials=/usr/src/access.smb 0 0

然后我有以下 mount --bind 行:

/mnt/files /var/www/html/data none defaults,bind 0 0

但是第二个挂载不起作用。如果我重新启动计算机,则只有第一个挂载有效。我需要手动安装第二个(使用绑定)

请问,有人可以帮我吗?我在 Unix Stack Exchange 上看到了这篇文章,但我不明白:https ://unix.stackexchange.com/questions/216287/how-do-i-set-up-bind-mounts-on-startup-correctly-in -系统世界

提前致谢。

linux nfs mount samba bind
  • 1 个回答
  • 93 Views
Martin Hope
Richard Rosner
Asked: 2022-03-16 12:57:33 +0800 CST

带有 FS-Cache 的 NFS - 已设置,但仍表示已禁用

  • 0

我在这里遇到了和这个问题差不多的问题,但是这个问题似乎已经解决了,因为 cachefilesd 尚未启用。我启用了它(在 /etc/default/cachefilesd 中删除了 RUN=yes 之前的注释)并重新启动了服务,但我仍然得到

root@pc01:~# cat /proc/fs/nfsfs/volumes
NV SERVER   PORT DEV          FSID                              FSC
v4 86826879  801 0:46         0:0                               no

其他帖子中提到的其他输出是:

root@pc01:~# mount
[snip]
/fscache.img on /var/cache/fscache type ext4 (rw,relatime)
server:/shares on /shares type nfs4 (rw,nosuid,nodev,noexec,noatime,vers=4.2,rsize=1048576,wsize=131072,namlen=255,hard,proto=tcp,timeo=50,retrans=2,sec=sys,clientaddr=xxx,fsc,local_lock=none,addr=xxx)
server:/home on /home type nfs4 (rw,nosuid,nodev,noexec,noatime,vers=4.2,rsize=1048576,wsize=131072,namlen=255,hard,proto=tcp,timeo=50,retrans=2,sec=sys,clientaddr=xxx,fsc,local_lock=none,addr=xxx)
[snip]

是的,我已将 fscache 放入一个 ext4 格式的图像文件中,大约 10 GB 大,因为我不想创建单独的分区并且 Btrfs 不支持 user_xattr 就我所知。

root@pc01:~# lsmod | grep cachefiles
cachefiles             86016  1
fscache                389120  2 cachefiles,nfs
root@pc01:~# uname -r
5.16.11-76051611-generic
root@pc01:~# grep CONFIG_NFS_FSCACHE /boot/config-5.16.11-76051611-generic 
CONFIG_NFS_FSCACHE=y
root@pc01:~# lsb_release -a
No LSB modules are available.
Distributor ID: Pop
Description:    Pop!_OS 21.10
Release:    21.10
Codename:   impish
root@pc01:~# dmesg | grep cache
[    0.019397] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.019576] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.043975] random: get_random_u64 called from kmem_cache_open+0x2b/0x360 with crng_init=1
[    0.082514] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.082543] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.256293] PCI: pci_cache_line_size set to 64 bytes
[    0.262202] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[   45.997860] FS-Cache: Cache "mycache" added (type cachefiles)
[   45.997863] CacheFiles: File cache on loop0 registered
root@pc01:~# ps aux | grep cachefilesd
root        1147  0.0  0.0   2876  1172 ?        SNs  14:29   0:00 /sbin/cachefilesd
root        9650  0.0  0.0  21912  2416 pts/0    S<+  14:45   0:00 grep --color=auto cachefilesd
nfs cache
  • 2 个回答
  • 129 Views
Martin Hope
cplater
Asked: 2022-02-21 08:21:52 +0800 CST

什么会阻止 php-fpm (8.0.16) 能够写入 NFS 挂载的文件系统?

  • 0

我有一个无法将文件写入 NFS 共享的 php-fpm (8.0.16) 实例。我正在使用一个简单的 php 脚本进行测试:

<?php

ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);

$fp = fopen('test.txt', 'a');

fwrite($fp, 'test'); 

通过 php-fpm 运行时,在作为 NFS 共享的目录中,收到以下错误:

警告:fopen(test.txt):无法打开流:/path/to/nfs/share/test-write.php 中的只读文件系统

但是,以下代码:

<?php

ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);

$fp = fopen('/tmp/test.txt', 'a');

fwrite($fp, 'test');

按预期工作。

该脚本在从命令行以用于在 NFS 共享目录和 /tmp 中运行 php-fpm 的同一用户运行时工作。此外,该脚本通过 php-fpm 在早期版本的 php 上按预期工作。

nfs php php-fpm
  • 1 个回答
  • 252 Views
Martin Hope
alex3025
Asked: 2022-01-25 11:14:33 +0800 CST

Rsync:“chown 失败:权限被拒绝 (13)”

  • 0

我使用以下命令在每个午夜运行一个 rsync 任务:

rsync -ahzP --stats --update --delete-before --delete-excluded --exclude "*.log" --exclude temp /mnt/raid/ /mnt/backups > /root/ext_backup.log 2>&1

/mnt/backups是一个 NFS 挂载。

备份过程顺利运行了大约半小时,然后我收到以下错误:

rsync: [receiver] write failed on "/my/file": Input/output error (5)
rsync: [receiver] chown "/my/file" failed: Permission denied (13)
rsync error: error in file IO (code 11) at receiver.c(378) [receiver=3.2.3]

rsync: [sender] write error: Broken pipe (32)

可能是什么问题呢?

linux ubuntu nfs mount rsync
  • 1 个回答
  • 1049 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve