LiangShuang's ...

I'm not a programmer...

fedora防火墙太厉害了!

shuang posted @ 2010年12月19日 01:58 in fedora with tags fedora firewall nc samba , 8319 阅读

    最近新装了Fedora14,感觉还不错,就是用惯了ubuntu对于Fedora的一些习性有些不太习惯,不如说第一次用sudo的时候系统提示当前用户不在sudoers列表中,只好再手动添加一遍了:

# Change to root
su
# Make /etc/sudoers writable
chmod +w /etc/sudoers
# Add user to sudoers
echo "username ALL=(ALL) ALL" >> /etc/sudoers
chmod -w /etc/sudoers
# Ctrl-D to resume

除了这个和ubuntu的用法不太一样,还有网卡的配置文件,添加软件源……,这些还好都能在网上找到相关的用法。但是当我在Fedora上安装samba共享linux下的目录时又出现了一个问题。按照网上的安装教程sudo yum install -y samba,然后设置/etc/samba/smb.conf文件,修改后testparm结果如下:

[global]
	server string = %h server(Samba,fedora)
	username map = /etc/samba/smbusers
	log file = /var/log/samba/log.%m
	max log size = 50
	cups options = raw

[printers]
	comment = All Printers
	path = /var/spool/samba
	printable = Yes
	browseable = No

[ShareFedora]
	comment = share with widows
	path = /home/water/Share
	valid users = water
	read only = No
	create mask = 0777
	directory mask = 0777
	guest ok = Yes
	locking = No

然后添加smb用户sudo smbpasswd -a username,在/etc/samba/smbusers加上,water = "network username",然后重启samba服务,sudo service smb restart,在windows下访问测试说没有权限访问此计算机,在ubuntu下也用过samba和windows系统共享文件怎么就没出现过这种问题呢?于是又在网上查了其他的一些教程,才发现Fedora的防火墙selinux对samba进行了限制,需要修改防火墙过滤规则(/etc/sysconfig/iptables要求有root权限),让防火墙不要拦截windows用户对samba的访问,sudo system-config-firewall,在打开的Trusted Services配置页面,选中Linux Samba和Samba Client,并Apply,然后重启samba服务,一切都正常访问了,另外还可以直接把防火墙关掉,虽然这样会引起安全问题。

    这个问题是我联想起前几天使用nc传文件的问题,我能给别人传cat filename | nc <ip> <port>,但是别人传过来的文件我却接受不到,nc -l 1234 > <filename>,今天试着把防火墙关了再试试,结果真的是Fedora的防火墙限制了一些网络程序的访问。

Avatar_small
bachue 说:
2010年12月19日 05:04

可以在vi中修改/etc/sudoers然后用:wq!来保存,比先chmod +w然后chmod -w方便

Avatar_small
依云 说:
2010年12月19日 05:30

@bachue: sudoers 应该用 visudo 编辑的 :-) CAVEATS The sudoers file should always be edited by the visudo command which locks the file and does grammatical checking. It is imperative that sudoers be free of syntax errors since sudo will not run with a syntactically incorrect sudoers file.

water@2012 说:
2010年12月19日 05:58

@依云: when i issue the command visudo, it needs the root permission. So I change to root role, but what i got is /etc/sudoers.tmp, i don't know why. By the way, i'm new to fedora, so you know...

Avatar_small
依云 说:
2010年12月19日 06:05

@water@2012: 这个当然是需要加 sudo 的。至于 /etc/sudoers.tmp,它是个临时文件,编辑完后 visudo 会用它覆盖 /etc/sudoers 的。不过这些是我的猜测,因为我也没用过 visudo。

Avatar_small
纵横天下 说:
2010年12月25日 09:30

fc的防火墙肯定比win下的好!

@依云: 我用过visudo,是vi壳子,但是会对你的输入进行检查,如果有不对的地方,他就会发出警告提示你修改,要么是放弃,这样一般很难出错 :-)

light novel 说:
2019年2月21日 16:38

I enjoyed over read your blog post. This was actually what i was looking for and i am glad to came here!

aaa 说:
2021年6月28日 10:39

Thanks a lot for sharing this excellent info! I am looking forward to seeing more posts by you as soon as possible! I have judged that you do not compromise on quality. Kinemaster Pro APk

aaa 说:
2021年6月28日 10:50

Today, I was just browsing along and came upon your blog. Just wanted to say good blog and this article helped me a lot, due to which I have found exactly I was looking. tekken 5 apk download

AAA 说:
2021年7月19日 09:08

Ones own favorite songs is without a doubt astonishing. You have got various highly athletic animators. As i intend one the ideal in achieving success. notepad html games

AAA 说:
2021年7月28日 09:06

This is often as a result exquisite and even very creative. Freezing take pleasure in that tones and even whomever makes the application with the -mail can be beaming. Daily Newspaper

AAA 说:
2021年8月20日 02:23

Appreciate it with the write-up in addition to good points.. possibly When i likewise imagine that working hard is usually an important part of having achievements. download kinemaster pro mod apk

AAA 说:
2021年8月31日 21:37

I'm going to learn this. I'll make sure to come back. thanks for sharing. and also This short article provides the light by which we are able to observe the reality. this really is good one and gives indepth information. thanks for this nice article... All Bangla Newspaper

Techner 说:
2023年9月20日 19:58

I recently had the opportunity to explore the <a href="https://www.techner.company/services/website-development/">Mobile App Development Services in Tricity</a>, and I must say, I was thoroughly impressed! The region's tech industry has truly evolved, and the mobile app development companies here are setting new standards in innovation and customer satisfaction.

civaget 说:
2023年12月13日 08:42

Remember, 구글 상위노출 isn't just about keywords and backlinks; it's about delivering exceptional value to your audience through high-quality content.

civaget 说:
2023年12月14日 03:21

Discover relaxation at its finest at 인천오피. The hot stone massage is incredibly relaxing, and the facial treatments leave you looking and feeling refreshed.

civaget 说:
2023年12月16日 02:24

I never knew 수원출장마사지 had so many benefits. Definitely adding it to my self-care routine.

civaget 说:
2023年12月20日 02:19

I recommend무료스포츠중계to anyone looking for a cost-effective way to enjoy sports.

civaget 说:
2023年12月27日 09:02

일산휴게텔 goes above and beyond. Their variety of massages ensures there's something for everyone, making it the ultimate relaxation spot in the city.

civaget 说:
2023年12月29日 23:29

Step into the world of cinema with 누누티비. No ads, just endless entertainment options.

civaget 说:
2024年1月08日 03:38

제주오피 elevates relaxation to an art form, with deep tissue massages, aromatherapy, and a focus on your well-being.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter