| # 参考地址 |
| https://unix.stackexchange.com/questions/519403/nt-status-access-denied-listing-when-moving-home-directories-to-another-locat |
| |
| [root@servera ~]# setfacl -m u:barney:rwX /groupdir/ |
| [root@servera ~]# smbclient -U barney //localhost/common |
| Enter STAFF\barney's password: |
| Try "help" to get a list of possible commands. |
| smb: \> mkdir opop |
| smb: \> ls |
| . D 0 Tue Jun 2 10:41:55 2020 |
| .. D 0 Tue Jun 2 09:24:11 2020 |
| opop D 0 Tue Jun 2 10:41:55 2020 |
| |
| 10474476 blocks of size 1024. 8168980 blocks available |
| |
| |
| # 不能直接写入/创建文件,即使下面直接写入文件没报错,但在共享目录中不会存在 |
| smb: \> echo "12345" >> 1.txt |
| |
| |
| |
| # 客户端使用同用户登录samba测试下 |
| [root@serverb ~]# yum -y install samba-client |
| [root@serverb ~]# mkdir /mnt/opop |
| [root@serverb ~]# mount -t cifs -o username=barney,password=redhat //172.25.250.10/common /mnt/opop |
| [root@serverb ~]# df -Th /mnt/opop |
| Filesystem Type Size Used Avail Use% Mounted on |
| //172.25.250.10/common cifs 10G 2.2G 7.8G 23% /mnt/opop |
| |
| [root@serverb ~]# smbclient -U barney //172.25.250.10/common |
| Enter SAMBA\barney's password: |
| Try "help" to get a list of possible commands. |
| smb: \> mkdir kkkk |
| smb: \> ls |
| . D 0 Tue Jun 2 10:51:20 2020 |
| .. D 0 Tue Jun 2 09:24:11 2020 |
| opop D 0 Tue Jun 2 10:41:55 2020 |
| kkkk D 0 Tue Jun 2 10:51:20 2020 |
| |
| |
| smb: \> q |
| [root@serverb ~]# ll /mnt/opop/ # 在客户端查看挂载点中新创建的目录 |
| total 0 |
| drwxr-xr-x. 2 root root 0 Jun 2 10:51 kkkk # 注意这里的权限属主和属组都是root用户 |
| drwxr-xr-x. 2 root root 0 Jun 2 10:41 opop |
| |
| |
| [root@servera ~]# ll /groupdir/ # 在服务段查看共享目录 |
| total 0 |
| drwxr-xr-x. 2 barney barney 6 Jun 2 10:51 kkkk # 在共享目录中新创建的属主和属组都是barney用户 |
| drwxr-xr-x. 2 barney barney 6 Jun 2 10:41 opop |
| |
| |
| [root@serverb ~]# ll |
| total 16 |
| -rw-------. 1 root root 6971 Oct 30 2019 anaconda-ks.cfg |
| -rw-------. 1 root root 6774 Oct 30 2019 original-ks.cfg |
| |
| [root@serverb ~]# smbclient -U barney //172.25.250.10/common |
| Enter SAMBA\barney's password: |
| Try "help" to get a list of possible commands. |
| smb: \> put /root/anaconda-ks.cfg # 记住该报错,下面会有说明 |
| NT_STATUS_OBJECT_PATH_NOT_FOUND opening remote file \root\anaconda-ks.cfg |
| |
| |
| # 解决 |
| [root@serverb ~]# useradd barney |
| [root@serverb ~]# yum -y install samba |
| [root@serverb ~]# smbpasswd -a barney |
| New SMB password: # 密码都是redhat |
| Retype new SMB password: |
| Added user barney. |
| |
| |
| [barney@serverb ~]$ echo "123456" >> 1.txt |
| [barney@serverb ~]$ ll |
| total 4 |
| -rw-rw-r--. 1 barney barney 7 Jun 2 11:07 1.txt |
| |
| # 再来登录并上传新创建的1.txt |
| [barney@serverb ~]$ smbclient -U barney //172.25.250.10/common |
| Unable to initialize messaging context |
| Enter SAMBA\barney's password: |
| Try "help" to get a list of possible commands. |
| # 报错了 |
| smb: \> put /home/barney/1.txt |
| NT_STATUS_OBJECT_PATH_NOT_FOUND opening remote file \home\barney\1.txt |
| smb: \> q |
| [barney@serverb ~]$ ll # 该路径下确实有1.txt但依旧不能上传,实际上该流程并没有问题 |
| total 4 |
| -rw-rw-r--. 1 barney barney 7 Jun 2 11:07 1.txt |
| |
| # 再来上传一次,这次不使用绝对路径 |
| [barney@serverb ~]$ smbclient -U barney //172.25.250.10/common |
| Unable to initialize messaging context |
| Enter SAMBA\barney's password: |
| Try "help" to get a list of possible commands. |
| smb: \> put 1.txt =======> 上传时必须在文件所在目录中登录samba且不要使用绝对路径 |
| putting file 1.txt as \1.txt (3.4 kb/s) (average 3.4 kb/s) |
| smb: \> ls |
| . D 0 Tue Jun 2 11:10:39 2020 |
| .. D 0 Tue Jun 2 09:24:11 2020 |
| opop D 0 Tue Jun 2 10:41:55 2020 |
| kkkk D 0 Tue Jun 2 10:51:20 2020 |
| 1.txt A 7 Tue Jun 2 11:10:39 2020 |
| |
| 10474476 blocks of size 1024. 8168952 blocks available |
| |
| smb: \> q |
| |
| |
| # 测试多文件上传 |
| [barney@serverb ~]$ touch {2..5}.txt |
| [barney@serverb ~]$ ll |
| total 4 |
| -rw-rw-r--. 1 barney barney 7 Jun 2 11:07 1.txt |
| -rw-rw-r--. 1 barney barney 0 Jun 2 11:14 2.txt |
| -rw-rw-r--. 1 barney barney 0 Jun 2 11:14 3.txt |
| -rw-rw-r--. 1 barney barney 0 Jun 2 11:14 4.txt |
| -rw-rw-r--. 1 barney barney 0 Jun 2 11:14 5.txt |
| |
| |
| [barney@serverb ~]$ smbclient -U barney //172.25.250.10/common |
| smb: \> ? =====> 查看所有可用命令 |
| ? allinfo altname archive backup |
| blocksize cancel case_sensitive cd chmod |
| chown close del deltree dir |
| du echo exit get getfacl |
| geteas hardlink help history iosize |
| lcd link lock lowercase ls |
| l mask md mget mkdir |
| more mput newer notify open |
| posix posix_encrypt posix_open posix_mkdir posix_rmdir |
| posix_unlink posix_whoami print prompt put |
| pwd q queue quit readlink |
| rd recurse reget rename reput |
| rm rmdir showacls setea setmode |
| scopy stat symlink tar tarmode |
| timeout translate unlock volume vuid |
| wdel logon listconnect showconnect tcon |
| tdis tid utimes logoff .. |
| ! |
| |
| smb: \> mput 2.txt 3.txt 4.txt ===> 换成mput命令即可,多文件之间用空格分隔,多文件下载用mget |
| Put file 2.txt? y ===> 这里仅做测试,因为该文件已经存在所以会有该提示 |
| putting file 2.txt as \2.txt (0.0 kb/s) (average 0.0 kb/s) |
| Put file 3.txt? y |
| putting file 3.txt as \3.txt (0.0 kb/s) (average 0.0 kb/s) |
| Put file 4.txt? y |
| putting file 4.txt as \4.txt (0.0 kb/s) (average 0.0 kb/s) |
| smb: \> ls |
| . D 0 Tue Jun 2 11:18:34 2020 |
| .. D 0 Tue Jun 2 09:24:11 2020 |
| opop D 0 Tue Jun 2 10:41:55 2020 |
| kkkk D 0 Tue Jun 2 10:51:20 2020 |
| 1.txt A 7 Tue Jun 2 11:10:39 2020 |
| 3.txt A 0 Tue Jun 2 11:18:32 2020 |
| 2.txt A 0 Tue Jun 2 11:18:30 2020 |
| 4.txt A 0 Tue Jun 2 11:18:34 2020 |
| |
| 10474476 blocks of size 1024. 8169032 blocks available |
| |
| |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
2021-01-02 日常随手记