samba

Linux运维常见故障排查和处理的技巧汇总

大憨熊 提交于 2021-02-20 19:57:46
作为Linux运维,工作中多多少少会遇见这样那样的问题或故障, 从中总结经验,查找问题,汇总并分析故障的原因,这是一个Linux运维工程师良好的习惯。 每一次技术的突破,都经历着苦闷,伴随着快乐,可我们还是执着的继续努力,从中也积累了更多的经验。 下面汇总了可能出现的故障及解决方法,看看你是否遇到过?并对你有帮助? 第一: 常见问题解决集锦 1.shell脚本不执行 问题: 某天研发同事找我说帮他看看他写的shell脚本,死活不执行,报错。我看了下,脚本很简单,也没有常规性的错误,报“:badinterpreter:Nosuchfileordirectory”错。 看这错,我就问他是不是在windows下编写的脚本,然后在上传到linux服务器的……果然。 原因: 在DOS/windows里,文本文件的换行符为rn,而在*nix系统里则为n,所以DOS/Windows里编辑过的文本文件到了*nix里,每一行都多了个^M。 解决: 1)重新在linux下编写脚本; 2)vi:%s/r//g:%s/^M//g(^M输入用Ctrl+v,Ctrl+m) 附:sh-x脚本文件名,可以单步执行并回显结果,有助于排查复杂脚本问题。 2.crontab输出结果控制 问题: /var/spool/clientmqueue目录占用空间超过100G 原因: cron中执行的程序有输出内容

linux网络命令

荒凉一梦 提交于 2021-02-19 17:56:29
网络和监控命令类似于这些: hostname, ping, ifconfig, iwconfig, netstat, nslookup, traceroute, finger, telnet, ethtool 用于查看 linux 服务器 ip 地址,管理服务器网络配置,通过 telnet 和 ethernet 建立与 linux 之间的网络链接,查看 linux 的服务器信息等。下面让我们看看在 Linux 下的网络和监控命令的使用。 1. hostname hostname 没有选项,显示主机名字 hostname –d 显示机器所属域名 hostname –f 显示完整的主机名和域名 hostname –i 显示当前机器的 ip 地址 补充:其实使用 “hostname+新的主机名” 命令还可以临时设置主机名,比如 hostname newname 这样用的好处是,可以临时修改主机名称而不用重启。而通过/etc/sysconfig/network 文件来修改主机名则需要重启才能生效。当然,我们在在执行这个命令后,必须记得手动修改/etc/sysconfig/network 文件里面的 HOSTNAME 的值,以便后续重启生效,这算是一个小技巧哦! 2. ping ping 将数据包发向用户指定地址。当包被接收,目标机器发送返回数据包。ping 主要有两个作用:

centos 7 ,8 安装samba一般步骤,解决用户名密码无法登录的问题,解决ntlm和lanman访问限制

ⅰ亾dé卋堺 提交于 2021-02-12 01:55:10
centos 7 ,8 安装samba一般步骤,解决用户名密码无法登录的问题,解决ntlm和lanman访问限制 参考文章: (1)centos 7 ,8 安装samba一般步骤,解决用户名密码无法登录的问题,解决ntlm和lanman访问限制 (2)https://www.cnblogs.com/sdgtxuyong/p/11769743.html 备忘一下。 来源: oschina 链接: https://my.oschina.net/u/4438370/blog/4952394

Cannot copy file from a remote machine using shutil

末鹿安然 提交于 2021-02-08 19:44:00
问题 I need to copy a file from a remote machine. The code is something like this import shutil shutil.copyfile('//XXX.XXX.XXX.XXX/home/Shares Folder/file.txt','/home/file.txt') the location of the file is a shared folder but everytime I run this it gives me this error File "", line 1, in ? File "usr/lib/python2.4/shutil.py", line 47, in copyfile frsc = open (src,'rb') IOError: [Errno 2] No such file or directory : '//XXX.XXX.XXX.XXX/home/Shares Folder/file.txt' Please take note that I'm running

Cannot copy file from a remote machine using shutil

倖福魔咒の 提交于 2021-02-08 19:41:23
问题 I need to copy a file from a remote machine. The code is something like this import shutil shutil.copyfile('//XXX.XXX.XXX.XXX/home/Shares Folder/file.txt','/home/file.txt') the location of the file is a shared folder but everytime I run this it gives me this error File "", line 1, in ? File "usr/lib/python2.4/shutil.py", line 47, in copyfile frsc = open (src,'rb') IOError: [Errno 2] No such file or directory : '//XXX.XXX.XXX.XXX/home/Shares Folder/file.txt' Please take note that I'm running

Samba (Cannot Write) issue

偶尔善良 提交于 2021-02-08 06:33:29
问题 I have setup Samba between two linux boxes (Ubuntu Desktop 12.10 and Ubuntu Server 12.04). For some reason I cannot write to my samba share. To me it looks like I have the correct permissions. Below is my smb.conf, the filesystem permissions, and the steps I followed. I definitely have it misconfigured but I cannot find out how. Any help would be appreciated. Craig Created a user in ubuntu server (craig) Created a user and password in samba "smbuseradd -a craig" set the password Mounted the

使用Windows 2008R2中的NFS替代Samba协议,解决Windows 与Linux共享文件的问题

久未见 提交于 2021-02-06 14:32:50
使用Windows 2008R2中的NFS替代Samba协议,解决Windows 与Linux共享文件的问题 参考文章: (1)使用Windows 2008R2中的NFS替代Samba协议,解决Windows 与Linux共享文件的问题 (2)https://www.cnblogs.com/littlehb/p/9086266.html 备忘一下。 来源: oschina 链接: https://my.oschina.net/u/4437884/blog/4948197

smbclient - Send all files in directory

喜夏-厌秋 提交于 2021-02-06 11:10:25
问题 I created a shell script to send files on Linux to Windows via sbmclient. smbclient //HOST_WINDOWS/D$ -U USER --pass PASSWORD -c "put /tmp/test.txt FOLDER_WINDOWS/test.txt" That works perfectly. smbclient //HOST_WINDOWS/D$ -U USER --pass PASSWORD -c "put /tmp/* FOLDER_WINDOWS" I would like to send all files at once, is it possible? 回答1: I found that it only works reliably when the local working directory is equal to the directory that you want to upload. But it's possible to specify a local

smbclient - Send all files in directory

不打扰是莪最后的温柔 提交于 2021-02-06 11:07:51
问题 I created a shell script to send files on Linux to Windows via sbmclient. smbclient //HOST_WINDOWS/D$ -U USER --pass PASSWORD -c "put /tmp/test.txt FOLDER_WINDOWS/test.txt" That works perfectly. smbclient //HOST_WINDOWS/D$ -U USER --pass PASSWORD -c "put /tmp/* FOLDER_WINDOWS" I would like to send all files at once, is it possible? 回答1: I found that it only works reliably when the local working directory is equal to the directory that you want to upload. But it's possible to specify a local

smbclient - Send all files in directory

China☆狼群 提交于 2021-02-06 11:07:14
问题 I created a shell script to send files on Linux to Windows via sbmclient. smbclient //HOST_WINDOWS/D$ -U USER --pass PASSWORD -c "put /tmp/test.txt FOLDER_WINDOWS/test.txt" That works perfectly. smbclient //HOST_WINDOWS/D$ -U USER --pass PASSWORD -c "put /tmp/* FOLDER_WINDOWS" I would like to send all files at once, is it possible? 回答1: I found that it only works reliably when the local working directory is equal to the directory that you want to upload. But it's possible to specify a local