freebsd怎么启动sshd服务无法启动

tanzhenchao 的BLOG
用户名:tanzhenchao
文章数:154
评论数:31
访问量:38598
注册日期:
阅读量:5863
阅读量:12276
阅读量:383496
阅读量:1074992
51CTO推荐博文
1、前言笔者出来工作多年,对属于unix分支的bsd系列freebsd的大名早有耳闻。今天终于下定决心去玩一下,发现与linux的细致还是有差异的,将常见的配置记录于此,供往后参阅。2、系统的安装系统下载:系统的安装:注:请安装FreeBSD 10.2-RELEASE3、服务的管理3.1、查看当前安装的服务ls&/etc/rc.d/3.2、服务的选项/etc/rc.d/moused显式如下:Usage:&/etc/rc.d/moused&[fast|force|one|quiet](start|stop|restart|rcvar|enabled|status|poll)3.3、服务操作/etc/rc.d/moused&start&#moused服务的启动
/etc/rc.d/moused&restart&#moused服务的重启
/etc/rc.d/moused&status&#moused服务的状态
/etc/rc.d/moused&stop&#moused服务的关闭3.4、服务自启动vi&/etc/rc.conf配置如下:moused_enable="YES"&#moused服务默认开机启动
moused_enable="NO"&#moused服务默认开机不启动3.5、常见的服务清单/etc/rc.d/netif&#网络接口服务
/etc/rc.d/routing&#路由服务注:使用方式请参考3.3服务的操作4、网络的配置4.1、有线网络4.1.1、dhcp自动获取IPvi&/etc/rc.conf配置如下:ifconfig_re0="DHCP"re0为指定的网卡名称4.1.2、静态IP配置vi /etc/rc.conf详细配置如下ifconfig_re0="inet&10.168.0.8&netmask&255.255.255.0"&#IP地址配置
ifconfig_re0_alias0="inet&10.168.0.9&netmask&255.255.255.0"&#多个IP地址配置(可选)
defaultrouter="10.168.0.1"&#网关配置重启服务/etc/rc.d/netif&restart&#重启网络接口服务使IP配置生效
/etc/rc.d/routing&restart&#重启网络接口服务使路由配置生效4.2、dns配置vi&/etc/resolv.conf详细配置如下:nameserver&202.96.128.86
nameserver&202.96.128.166
nameserver&8.8.8.8
nameserver&8.8.4.44.3、无线网络4.3.1、提取windows驱动1)去一键工作室下载个U盘pe制作工具,网址: 2)从U盘的PE系统启动3)启动PE网络的模式4)使用PE自带的驱动提取工具提取无线网卡的驱动文件(*.inf,*.sys)注:以上适用于32位操作系统4.3.2、制作内核驱动1)提取的驱动文件U盘复制到系统mount&-t&msdos&/dev/da1s1&/mnt/&#挂载U盘注:卸载方法unmount&/mnt&#卸载U盘2)生成内核驱动cd&/mnt
ndisgen&x.inf&x.sys注:以上一路回车即可看到生成的x_sys.ko文件4.3.3、加载内核驱动1)手动加载kldload&./x_sys.ko
ifconfig可发现无线网卡:ndis0:&flags=8843&UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&&metric&0&mtu&2290
&&&&&&&&ether&00:25:56:77:85:b6
&&&&&&&&nd6&options=29&PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL&
&&&&&&&&media:&IEEE&802.11&Wireless&Ethernet&autoselect&mode&11g
&&&&&&&&status:&associated2)自动加载内核cp&./x_sys.ko&/boot/modules/
echo&"kldload&/boot/modules/x_sys.ko"&&&&/etc/rc.local4.3.4、加载无线所需的其他内核1)内核加载if_ath_load="YES"
wlan_scan_ap_load="YES"
wlan_scan_sta_load="YES"
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"2)重启系统reboot4.3.5、创建无线1)手动创建无线ifconfig&wlan0&create&wlandev&ndis02)自动创建无线echo&"ifconfig&wlan0&create&wlandev&ndis0"&&&&/etc/rc.local4.3.6、创建无线认证1)配置认证vi&&/etc/wpa_supplicant.conf加入如下配置:network={
&&ssid="ssid-name"
&&psk="password"
}2)重启网络服务/etc/rc.d/netif&restart4.3.7、检查ifconfig显示如下:wlan0:&flags=8843&UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&&metric&0&mtu&1500
&&&&&&&&ether&00:25:56:77:85:b6
&&&&&&&&inet&10.168.0.77&netmask&0xffffff00&broadcast&10.168.0.255
&&&&&&&&nd6&options=29&PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL&
&&&&&&&&media:&IEEE&802.11&Wireless&Ethernet&autoselect&mode&11g
&&&&&&&&status:&associated
&&&&&&&&ssid&will-work&channel&6&(2437&MHz&11g)&bssid&12:18:d6:8f:b7:f8
&&&&&&&&country&US&authmode&WPA2/802.11i&privacy&OFF&powersavemode&CAM
&&&&&&&&powersavesleep&100&txpower&0&bmiss&7&mcastrate&6&mgmtrate&6
&&&&&&&&scanvalid&60&protmode&CTS&roaming&MANUAL&bintval&04.3.8、图形wifi管理pkg&install&wifimgr5、软件包安装5.1、常用指令pkg&search&vim&#搜索vim
pkg&install&vim&#安装vim
pkg&remove&vim&#删除vim5.2、配置文件vi&/etc/pkg/FreeBSD.confFreeBSD:&{
&&url:&"pkg+http://pkg.FreeBSD.org/${ABI}/quarterly",
&&mirror_type:&"srv",
&&signature_type:&"fingerprints",
&&fingerprints:&"/usr/share/keys/pkg",
&&enabled:&yes
}6、ssh服务配置6.1、增加用户adduser执行完根据向导完成用户的信息填写。6.2、用户加入组vim /etc/groupwheel:*:0:root,user1因为root默认禁止ssh登录,故而将普通用户user1加入wheel组(可以使用su指令)6.3、切换至root用户su&-6.4、启动服务并/etc/rc.d/sshd&start6.5、设置服务自启动&vim&/etc/rc.conf配置如下sshd_enable="YES"7、命令行使用由于无法使用[end]等键,提供如下快捷方式供用户使用:[ctrl]+a&&#到达行首
[ctrl]+e&&#到达行尾
[ctrl]+u&&#向行首清除
[ctrl]+k&&#向行尾清除
[ctrl]+w&&#向行首清除一个单词8、桌面环境安装8.1、二进制包的安装pkg&install&xorg&gnome38.2、配置8.2.1、配置/proc挂载(GNOME运行需要)vim&/etc/fstab配置如下:proc&&&&&&&&&&&/proc&&&&&&&procfs&&rw&&0&&&0保存并退出后mount&-a8.2.2、配置启动文件echo&"/usr/local/bin/gnome-session"&&&~/.xinitrc8.2.3、开机启动桌面环境1)配置服务vim&/etc/rc.conf配置如下:gnome_enable="YES"或者这样写gdm_enable="YES"
dbus_enable="YES"2)重启并测试reboot8.2.4、手动启动桌面环境1)配置服务vim /etc/rc.conf配置如下:#gnome_enable="YES"
#gdm_enable="YES"
dbus_enable="YES"2)重启并测试reboot
startx8.2.5、中文输入法pkg&install&ibus&zh-ibus-pinyin安装完毕选择以下菜单添加输入法:Activities -& Setting -& Region & Language -& Input Sources -& 单击【+】 -& Chinese(China) -& Chinese(Pinyin) -& Add8.2.6、办公软件pkg&install&libreoffice&xpdf&xpdfopen&zh-xpdf-zhfont&firefox8.2.7、远程控制pkg&install&tigervnc8.2.8、图形软件pkg&install&gimp9、拯救模式9.1、什么是拯救模式拯救模式是用于系统拯救,如当修改内核参数发生错误,导致系统无法正常引导,我们需要借助光盘引导到正常的操作系统,并切换到可以修复原来系统环境的工作模式。9.2、操作步骤1)准备一张光盘并从光驱启动2)选择“boot single user”模式启动3)看到如下提示按回车Enter&full&pathname&of&shell&or&RETURN&for&/bin/sh:4)挂载文件系统mount&/dev/ad0p2&/mnt&#挂载系统分区到/mnt
ls&/mnt&#确认系统分区5)切换根到文件系统chroot&/mnt6)做反向操作修复错误配置文件7)重新引导进入系统reboot10、错误处理10.1、错误提示1pkg: cached package xxx: size mismatch, cannot continue处理命令:pkg&update&-f11、设置时区和校正时间cp&/usr/share/zoneinfo/Asia/Shanghai&/etc/localtime
ntpdate&0.pool.ntp.org--------------------------------------------------------------------参考文献:系统下载:U盘制作系统的安装:使用帮助: 无线驱动解决方法:本文出自 “” 博客,请务必保留此出处
了这篇文章
类别:┆阅读(0)┆评论(0)FreeBSD下开启SSH服务
(本文转自:)
首先vi编辑/etc/inetd.conf,去掉ssh前的#,保存退出
编辑/etc/rc.conf
最后加入:sshd_enable="yes"即可
激活sshd服务:
#/etc/rc.d/sshd start
用下面命令检查服务是否启动,在22端口应该有监听。
#netstat -an ## check port number 22
vi /etc/ssh/sshd_config,
下面是我的配置文件:(/etc/ssh/sshd_config)
####################################################
# $OpenBSD: sshd_config,v 1.72
11:59:40 markus Exp
# $FreeBSD: src/crypto/openssh/sshd_config,v 1.42.2.1
16:50:35 des Exp $
# This is the sshd server system-wide configuration file.
# sshd_config(5) for more information.
# This sshd was compiled with
PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config
shipped with
# OpenSSH is to specify options with their default value
# possible, but leave them commented. Uncommented options change
# default value.
# Note that some of FreeBSD's defaults differ from OpenBSD's,
# FreeBSD has a few additional options.
#VersionAddendum FreeBSD-
#Protocol 2
#AddressFamily any
#ListenAddress 10.1.10.196
#ListenAddress ::
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_dsa_key
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
#PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKey .ssh/authorized_keys
# For this to work you will also need host keys in
/etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# Change to yes to enable built-in password
authentication.
PasswordAuthentication yes
#PermitEmptyPasswords no
# Change to no to disable PAM authentication
#ChallengeResponseAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# Set this to 'no' to disable PAM authentication, account
processing,
# and session processing. If this is enabled, PAM authentication
# be allowed through the ChallengeResponseAuthentication
mechanism.
# Depending on your PAM configuration, this may bypass the setting
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM
account and
# session checks to run without PAM authentication, then enable
this but set
# ChallengeResponseAuthentication=no
#UsePAM yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10
# no default banner path
#Banner /some/path
# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server
IgnoreRhosts yes
IgnoreUserKnownHosts yes
PrintMotd yes
StrictModes no
RSAAuthentication yes
PermitRootLogin yes #允许root登录
PermitEmptyPasswords no #不允许空密码登录
PasswordAuthentication yes # 设置是否使用口令验证。
##############################################
记得修改完配置文件后,重新启动sshd服务器(/etc/rc.d/sshd restart)即可。
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。似水流年兮 的BLOG
用户名:似水流年兮
文章数:59
访问量:2871
注册日期:
阅读量:5863
阅读量:12276
阅读量:383496
阅读量:1074992
51CTO推荐博文
freebsd开启root远程登录服务器的操作
vi /etc/ssh/sshd_config
#PermitRootLogin no
PermitRootLogin yes
&重新启动sshd
/etc/rc.d/sshd restart
&本文出自 “” 博客,请务必保留此出处
了这篇文章
类别:┆阅读(0)┆评论(0)FreeBSD下登录SSH很慢的解决方法-BSD-电脑编程网FreeBSD下登录SSH很慢的解决方法作者:佚名 和相关&&使用SSH登录远程的时候,遇到输入了用户名以后等半天才出输入密码的框,后网上查资料,原来这是dns反查造成的。解决方法如下:1)编辑 /etc/ssh/sshd_config , 将 #UseDNS yes 取消注释,设为no ,重启sshd。2)编辑被机器的 /etc/hosts,将自己的ip以及对应的主机名加进去。(可选)附:方法2可以不加也没问题,另外其它慢的原因可能就是谁方面的了,可以更改以下设置KerberosAuthentication noGSSAPIAuthentication no碰到这样的问题可以采用ssh -v user@host方式登录,可详细列出登录信息,即可查出相应原因参考自:http://0e2.net/post/1207.html相关资料:|||||||FreeBSD下登录SSH很慢的解决方法来源网络,如有侵权请告知,即处理!编程Tags:                &                    sasyun 的BLOG
用户名:sasyun
文章数:18
访问量:4289
注册日期:
阅读量:5863
阅读量:12276
阅读量:383496
阅读量:1074992
51CTO推荐博文
修改freebsd可以用sshd权限用户登录ssh 但不能用root用户登录的方法在/etc/ssh/sshd_config最后中加入&PermitRootLogin yes #允许root登录PermitEmptyPasswords no #不允许空密码登录PasswordAuthentication yes # 设置是否使用口令验证。就可以了FreeBSD SSH配置详解首先vi编辑/etc/inetd.conf,去掉ssh前的#,保存退出 (开启****ssh服务)编辑/etc/rc.conf最后加入:sshd_enable="yes"即可&激活sshd服务:techo#/etc/rc.d/sshd start用下面命令检查服务是否启动,在22端口应该有****。#netstat -an ## check port number 22解决在FreeBSD上要使用su命令成为root用户,不但要知道root的口令,还需要经过特别设置,否则就不能成功使用这个命令。这是因为 FreeBSD对执行su命令的用户进行了更严格的限制,能使用su命令的用户必须属于wheel组(root的基本属组,组ID为0),否则就不能通过 这个命令成为root用户。因此需要编辑组设置文件/etc/group,将需要超级用户权力的管理成员加入到wheel组中。& & & 可以使用如下命令给普通用户su - root的权力:& & & pw groupmod wheel -m &username&& & & pw usermod &username& -g wheel& & & 或者直接修改/etc/group文件,把相应的用户加到wheell组就可以& & & wheel:*:0:root,usernameFreeBSD系统下默认是不允许root用户直接通过ssh连接到服务器的,在安装FreeBSD系统时要创建一个额外的用户,切忌一定要把这个用户加入到wheel组中。本文出自 “” 博客,请务必保留此出处
了这篇文章
类别:未分类┆阅读(0)┆评论(0)

我要回帖

更多关于 重新启动sshd服务 的文章

 

随机推荐