项目

一般

简介

Linux Config

范 益波大约 11 年 之前添加

1. centos vsftpd不能chroot的问题
是selinux的问题,它有一个叫做”Allow ftp to read/write in the user home directories” 的选项。使用如下命令
/usr/sbin/setsebool -P ftp_home_dir 1
打开选项,重启服务器,登录,一切ok了

2. vsftpd 配置 /etc/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
#anon_upload_enable=YES
#anon_mkdir_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
#chown_uploads=YES
#chown_username=whoever
#xferlog_file=/var/log/xferlog
xferlog_std_format=YES
#idle_session_timeout=600
#data_connection_timeout=120
#nopriv_user=ftpsecure
#async_abor_enable=YES
#ascii_upload_enable=YES
#ascii_download_enable=YES
#ftpd_banner=Welcome to blah FTP service.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
chroot_local_user=YES   限定用于在自己的home文件夹下
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#ls_recurse_enable=YES
listen=YES
#listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
hide_file=.*   不显示隐藏文件/文件夹

3. vncserver xstartup文件配置

#!/bin/sh

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[-x /etc/vnc/xstartup] && exec /etc/vnc/xstartup
[-r $HOME/.Xresources] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
# xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# twm &
gnome-session&

4. vncserver用法
4.1 user直接启动vncserver命令:

vncserver -depth 16 -geometry 1024x768 -nolisten tcp -nohttpd

http://www.iteye.com/topic/638468

4.2 root配置vncserver服务,user无需自己启动:
a) 配置/etc/sysconfig/vncservers

# 自己定义部分:运行用户jchen远程访问,分辨率为800*600
# 自己定义部分:运行用户jackie远程访问,分辨率为1024*768 
VNCSERVERS="2:jchen 3:jackie" 
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd" 
VNCSERVERARGS[3]="-geometry 1024x768" 

b) 配置用户VNC访问密码
[jackie@RHCE ~]$ mkdir .vnc 
[jackie@RHCE ~]$ cd .vnc 
[jackie@RHCE .vnc]$ vncpasswd 
Password: xxxxxx 
Verify: xxxxxx

c) 启动VNC服务
[root@RHCE ~]# service vncserver start

d) 配置VNC访问方式
[jackie~]# vi /home/jackie/.vnc/xstartup

e) 打开远程登录的防火墙端口
防火墙端口的值是:5900 + /etc/sysconfig/vncservers中该用户的id,例如要打开tom的远程登录的防火墙端口,其端口号为:5900 + 3 = 5903。

f) 设置完成之后可以重启vncserver
[root@localhost ~]# service vncserver restart

g) 如何监视vncserver的进程和端口
[root@localhost ~]# netstat -antpl|grep Xvnc
tcp        0      0 0.0.0.0:5801                0.0.0.0:*                   LISTEN      24322/Xvnc          
tcp        0      0 0.0.0.0:5802                0.0.0.0:*                   LISTEN      24379/Xvnc          
tcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN      24322/Xvnc          
tcp        0      0 0.0.0.0:5903                0.0.0.0:*                   LISTEN      24602/Xvnc          
tcp        0      0 0.0.0.0:6001                0.0.0.0:*                   LISTEN      24322/Xvnc

h) 参考
http://agile.blog.51cto.com/1455424/293895
http://jackiechen.blog.51cto.com/196075/143170
http://bobpeers.com/linux/vnc.php
http://space.itpub.net/519536/viewspace-607552
http://blog.chinaunix.net/u2/83656/showart_2067438.html

5. 防火墙设置
打开相应的防火墙端口

6. ssh无法连上
请检查本地是否有旧的ssh连接记录,删除之

7. centos 更新源设置
检查yum是否安装,默认情况下都是安装好的,总共4各包。

[root@linux-a ~]# rpm -qa |grep yum
yum-metadata-parser-1.0-8.fc6
yum-3.0.1-5.el5
yum-rhn-plugin-0.4.3-1.el5
yum-updatesd-3.0.1-5.el5

配置/etc/yum.repos.d/CentOS-Base.repo 文件(这里使用的是上海交大的CentOS更新源)
[base]
name=CentOS-5-Base
baseurl=http://ftp.sjtu.edu.cn/centos/5.6/os/$basearch/
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[update]
name=CentOS-5-Updates
baseurl=http://ftp.sjtu.edu.cn/centos/5.6/updates/$basearch/
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[addons]
name=CentOS-5-Addons
baseurl=http://ftp.sjtu.edu.cn/centos/5.6/addons/$basearch/
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[extras]
name=CentOS-5-Extras
baseurl=http://ftp.sjtu.edu.cn/centos/5.6/extras/$basearch/
gpgcheck=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[centosplus]
name=CentOS-5-Plus
baseurl=http://ftp.sjtu.edu.cn/centos/5.6/centosplus/$basearch/
gpgcheck=0
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[contrib]
name=CentOS-5-Contrib
baseurl=http://ftp.sjtu.edu.cn/centos/5.6/contrib/$basearch/
gpgcheck=0
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#[dag]
#name=Dag RPM Repository for RHEL5
#baseurl=http://ftp.riken.jp/Linux/dag/RedHat/el5/en/$basearch/dag/
#enabled=1
#gpgcheck=0
#gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt

导入key
 [root@linux-a ~]# rpm --import http://ftp.sjtu.edu.cn/centos/5.6/os/x86_64/RPM-GPG-KEY-CentOS-5

运行YUM,测试
 [root@linux-a ~]# yum install xmms-MP3


回复 (1)

RE: Linux Config - 由 范 益波大约 11 年 之前添加

RE: linux 配置 - 由 刘 家良 在 将近 2 年 之前添加
我刚刚看到yum原先的设置,之前的时候我在装版本管理工具git的时候,yum好像不能用,然后我将CentOS-Base.repo修改成了中科大的源。原先的文件,我放到CentOS-Base.repo.save文件里去了。

RE: linux 配置 - 由 刘 家良 在 将近 2 年 之前添加
CentOS-Base.repo又改回交大的了。当初不知道修改了了那些东西,没有记录下来。现在可以了。

$sudo yum install fonts-ISO8859-2.noarch

    (1-1/1)