add to sudoers and auto start services on Centos
How to add a CentOS user to the sudoers list
vi /etc/sudoers ...## Next comes the main part: which users can run what software on## which machines (the sudoers file can be shared between multiple## systems).## Syntax:#### user MACHINE=COMMANDS#### The COMMANDS section may have other options added to it.#### Allow root to run any commands anywhere root ALL=(ALL) ALL youruser ALL=(ALL) ALL
How to auto start services on boot in Centos / Redhat?
To auto start a new service:
- Find out the name of service’s script from /etc/init.d/ directory e.g. mysqld or httpd
- Add it to chkconfig
sudo /sbin/chkconfig --add mysqld
- Make sure it is in the chkconfig.
sudo /sbin/chkconfig --list mysqld
- Set it to autostart
sudo /sbin/chkconfig mysqld on
To stop a service from auto starting on boot
- sudo /sbin/chkconfig mysqld off
防火墙开放80端口
[root@localhost lele]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT [root@localhost lele]# /etc/rc.d/init.d/iptables save
如何修改centos等linux系统的hostname?重启后也生效
简单来说,uname -a 可以看到hostname,修改步骤如下:
- uname -a 查看hostname
- hostname www.ctohome.com 修改下,让hostname立刻生效。
- vi /etc/hosts 修改原hostname为 www.ctohome.com
- vi /etc/sysconfig/network 修改原hostname为 www.ctohome.com,这样可以让reboot重启后也生效
- reboot重启,uname -a 重新检查下。收工
相关推荐
changecan 2020-11-19
ECSHOP专属建设 2020-11-13
88427810 2020-11-02
步知道 2020-10-27
Junzizhiai 2020-10-10
jackalwb 2020-10-05
小网管 2020-09-03
shiwenqiang 2020-09-14
85251846 2020-09-14
summerinsist 2020-08-21
87901735 2020-08-19
PinkBean 2020-08-11
85407718 2020-08-09
MichelinMessi 2020-07-30
suosuo 2020-07-28
CARBON 2020-07-28
lizhengfa 2020-07-27
88427810 2020-07-26