分类 操作系统 下的文章

CentOS 安装远程桌面服务

1、安装 tigervncserver yum install tigervnc-server tigervnc-server-module 2、拷贝配置文件 cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service 3、进入到配置文件目录 cd /etc/systemd/system 4、修改配置文件 vim vncserver@:1.service 配置文件内容为: [Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking User=root ExecStart=/usr/bin/vncserver :1 -geometry 1280x1024 -depth 16 -securitytypes=none -fp /usr/share/X11/fonts/misc ExecStop=/usr/bin/vncserver -kill :1 [Install] WantedBy=multi-user.target 5、启用配置文件 systemctl enable vncserver@:1.service 6、设置登陆密码 vncpasswd 7、启动 vncserver systemctl start vncserver@:1.service 8、启动状态查看 systemctl status vncserver@:1.service 9、查看端口状态 netstat -lnt | grep 590* 10、查看报错信息 grep vnc /var/log/message...

Ubuntu 16.04 FTP 服务程序 vsftpd

安装: sudo apt install vsftpd 其配置文件为 /etc/vsftpd.conf write_enable=YES #允许写文件操作 useradd -M -s /sbin/nologin ftp1 #创建一个本地 ftp 用户 ftp1 sudo passwd ftp1 sudo service vsftpd restart 530 Login incorrect : 修改 /etc/pam.d/vsftpd: 将 auth required pam_shells.so 修改为 auth required pam_nologin.so 或者将 auth required pam_shells.so 注释 创建虚拟用户: 虚拟用户的文件读写需要一个真实用户配合,先创建一个真实用户(在配置文件中关联guest_username) sudo useradd -m -d /home/vsftpd vsftpd sudo usermod -s /sbin/nologin vsftpd 启用匿名用户 anonymous 匿名用户使用的是系统的 ftp 用户 sudo vim /etc/vsftpd.conf write_enable=YES #允许写文件操作 anonymous_enable=YES anon_upload_enable=YES #匿名用户上传使能 anon_mkdir_write_enable=YES #匿名用户创建文件夹使能 #anon_root=/home/ftp #匿名用户根目录,默认为/srv/ftp sudo service vsftpd restart 关于根目录写权限: 从 2.3.5 之后,vsftpd 增强了安全检查,如果用户被限定在了其主目录下,则该用户的主目录不能再具有写权限了!如果检查发现还有写权限,就会报错误: vsftpd: refusing to run with writable root inside chroot () 解决方法:去除用户主目录的写权限 chmod a-w /srv/ftp 在根目录创建一个ftp用户可以写的目录 sudo mkdir /srv/ftp/public sudo chmod 777 /srv/ftp/public 或者修改配置 allow_writeable_chroot=YES #允许根目...

CentOS 安装 VirtualBox

1、添加源 wget -P /etc/yum.repos.d http://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo 2、安装 yum install VirtualBox yum install dkms kernel-devel kernel-headers /sbin/vboxconfig #重新编译 VirtualBox 内核 3、将用户加入 vboxusers 组 sudo groupadd -G vboxusers -a root 4、开机自启动: vi /etc/rc.d/rc.local VBoxManage startvm 虚拟机名字 -type vrdp & chmod +x /etc/rc.d/rc.local 5、其他命令 VBoxManage list vms #列出虚拟机 VBoxManage list runningvms #列出运行中的虚拟机 VBoxManage controlvm 虚拟机名字 acpipowerbutton # 关闭虚拟机,等价于点击系统关闭按钮,正常关机 VBoxManage controlvm 虚拟机名字 poweroff # 关闭虚拟机,等价于直接关闭电源,非正常关...

Linux SMB 服务 Samba

Samba 是在 Linux 和 UNIX 系统上实现 SMB 协议的一个免费软件,由服务器及客户端程序构成。Linux 下的 Samba 服务主要用于 Windows 平台和 Linux 平台下载局域网内实现文件共享。 安装: apt-get update apt-get install samba 创建匿名共享文件夹: mkdir /data/share chmod 777 /data/share 配置: vim /etc/samba/smb.conf 在最后加上: [share] comment = share folder browseable = yes path = /data/share public = yes available = yes writable = yes guest ok = yes #重启服务 /etc/init.d/samba restart 或 service samba restart 如果碰巧你的 Win10 账户名与 Linux 中的账户名相同(不分大小写),那么 Win10 在访问 Samba 时会使用你的账户,如果密码不同,则提示你输入凭证,如果密码碰巧相同,则会直接以同名的 Linux 账户登录 samba,你创建的文件或文件夹都属于你的这个账户。要解决这个问题,可以设置 Win10 的 Windows 凭据,添加一个 nobody 空密码的账户...

Linux 内核常用函数头文件

linux/types.h size_t time_t clock_t uint8_t uint16_t ... linux/stddef.h NULL true false offsetof stdarg.h Linux 内核中没有 stdarg.h 头文件(stdarg 是编译器内建的,所以不包含在内核中),要使用编译工具链中的 stdarg.h 头文件。 linux/ctype.h isdigit、islower、isupper、tolower、toupper ... linux/string.h memcpy memmove memcmp memset strcpy strlen strcat strstr strcmp strchr strncpy strlcpy strnlen strncat strnstr strncmp strnchr linux/printk.h printk、vprintk linux/uaccess.h copy_to_user copy_from_user linux/slab.h kmalloc kzalloc krealloc kfree linux/vmalloc.h vmalloc vfree linux/kernel.h 当包含 linux/kernel.h 时就间接包含了 stdarg.h(不在内核中)、linux/types.h、linux/types.h、linux/printk.h 等头文件 sprintf、snprintf、vsprintf、vsnprintf 也在这里...

VMWare Ubuntu 扩容

1、在虚拟机的配置窗口使用“扩展...”按钮扩展磁盘容量。 注意,如果有快照就不能用了。需要删掉快照。 2、安装 gparted sudo apt install gparted 3、删除交换分区及扩展分区 4、调整分区大小 5、在未使用的磁盘空间创建扩展分区,再创建交换分区。 6、应用所有...

Ubuntu 安装 vsftpd

sudo apt install vsftpd service vsftpd start service vsftpd status 默认系统用户是可以登录的。 编辑配置文件 /etc/vsftpd.conf 取消注释:write_enable=YES service vsftpd restar...

Ubuntu 安装 Nginx

apt-get install nginx # 安装 service nginx status # 查看服务运行状态 netstat -nap |grep nginx # 查看服务所使用的端口 网页浏览器访问服务器 IP 显示: Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com. Thank you for using nginx...

Ubuntu 安装 PHP

安装: sudo apt-get install php Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: php-common php7.0 php7.0-cli php7.0-common php7.0-fpm php7.0-json php7.0-opcache php7.0-readline Suggested packages: php-pear The following NEW packages will be installed: php php-common php7.0 php7.0-cli php7.0-common php7.0-fpm php7.0-json php7.0-opcache php7.0-readline 0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded. Need to get 3,532 kB of archives. After this operation, 14.1 MB of additional disk space will be used. Do you want to continue? [Y/n] 除了自动安装的 php7.0-cli php7.0-common php7.0-fpm 等,再安装一些模块: sudo apt-get install php7.0-mysql php7.0-curl php7.0-mcrypt php7.0-mbstring php7.0-xml 测试: php -v PHP 7.0.32-0ubuntu0.16.04.1 (cli) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.32-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies php7.0-fpm 服务控制: sudo service php7.0-fpm stop sudo service php7.0-fpm start sudo service php7.0-fpm restart sudo service php7.0-fpm statu...

Ubuntu 下载内核源码

方法 1 uname -r apt-cache search linux-source //搜索内核版本 sudo apt-get install linux-source-4.15.0 会将内核源码包下载到 /usr/src 方法 2 apt-get source linux-image-$(uname -r) 可以下载到当前目录 我的测试结果是获取不到内核源码(源的配置没有问题)。 方法 3 git clone git://kernel.ubuntu.com/ubuntu/ubuntu-<release>.git git clone git://kernel.ubuntu.com/ubuntu/ubuntu-xenial.git (16.04) git tag -l Ubuntu-* 下载的源码很大,速度很慢(git 浅克隆可以解决太大的问题)。 安装编译内核可能依赖的库或工具 sudo apt-get install libncurses5-dev libssl-dev sudo apt-get install build-essential openssl sudo apt-get install zlibc minizip sudo apt-get install libidn11-dev libidn11 编译 #sudo make mrproper sudo make menuconfig sudo make -j4 安装内核 sudo make modules_install #安装内核模块 sudo make install #安装内核 内核用户手册 man sudo apt-get install xmlto  make mandocs -j4 #编译用户手册 sudo make installmandocs man print...