虚拟机安装CentOS6.3两个问题

时间:2021-10-04 15:59:15

虚拟机下CentOS安装教程:http://blog.csdn.net/21aspnet/article/details/6961518

由于前一阵子重新装win7,win7下的虚拟机CentOS也就没有,重装中遇到两个主要问题,记录一下。

1,连接secureCRT问题:

1)切换到root下,ntsysv打开sshd服务,关闭防火墙ip6tables, iptables

2)配置网卡,保证虚拟机能够上网

[centos@localhost ~]$ ifconfig 

eth0      Link encap:Ethernet  HWaddr 00:0C:29:83:DE:5E  

          inet addr:192.168.1.96  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fe83:de5e/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1256 errors:0 dropped:0 overruns:0 frame:0

          TX packets:413 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:105296 (102.8 KiB)  TX bytes:101337 (98.9 KiB)

          Interrupt:19 Base address:0x2000 





lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:16 errors:0 dropped:0 overruns:0 frame:0

          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:1080 (1.0 KiB)  TX bytes:1080 (1.0 KiB)

2,创建用户,添加sudo权限,取消每次sudo输入密码,这里已经创建centos用户。

[centos@localhost ~]$ su root

Password: 

[root@localhost centos]# ll /etc/sudoers

-r--r-----. 1 root root 4080 Aug 11 22:47 /etc/sudoers

[root@localhost centos]#
chmod +w /etc/sudoers  //修改文件加上w权限,才能够改写

[root@localhost centos]# vim /etc/sudoers

。。。。。。

## The COMMANDS section may have other options added to it.

##

## Allow root to run any commands anywhere 

root    ALL=(ALL)       ALL

centos All=(ALL)       ALL





## Allows members of the 'sys' group to run networking, software, 

## service management apps and more.

# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS





## Allows people in group wheel to run all commands

# %wheel        ALL=(ALL)       ALL





## Same thing without a password

# %wheel        ALL=(ALL)       NOPASSWD: ALL

%centos  ALL=(ALL) NOPASSWD: NOPASSWD: ALL

。。。。。。

[root@localhost centos]#chmod -w /etc/sudoers //此文件权限-r--r-----,修改之后需要改回,否则将无法执行sudo

[root@localhost centos]# ll /etc/sudoers

-r--r-----. 1 root root 4080 Aug 11 22:47 /etc/sudoers

[root@localhost centos]# exit

exit

[centos@localhost ~]$ sudo ls

mywork

[centos@localhost ~]$ OK