Freebsd Root密码破解
重启系统,进入单用户模式(选第四项),然后一次输入下面命令:
#fsck -y
#mount -a
#passwd root
Changing local password for root
New password:
Retype New Password:
#reboot
重启结束后密码ROOT密码改就修改好了,你就可以用你修改的密码登录root用户了。
个人博客网站,记录一些日常遇到的问题。
重启系统,进入单用户模式(选第四项),然后一次输入下面命令:
#fsck -y
#mount -a
#passwd root
Changing local password for root
New password:
Retype New Password:
#reboot
重启结束后密码ROOT密码改就修改好了,你就可以用你修改的密码登录root用户了。
编辑/etc/rc.conf
最后加入:sshd_enable=”yes”即可
激活sshd服务:
#/etc/rc.d/sshd start
用下面命令检查服务是否启动,在22端口应该有监听。
#netstat -an ## check port number 22
最后
vi /etc/ssh/sshd_config,
ee /etc/ssh/sshd_config
———————————————
#Protocol 2,1
修改为:
Protocol 2
#ListenAddress 0.0.0.0
修改为:
ListenAddress 0.0.0.0
#PermitRootLogin yes
修改为
PermitRootLogin yes
IgnoreRhosts yes
IgnoreUserKnownHosts yes
PrintMotd yes
StrictModes no
RSAAuthentication yes
PermitRootLogin yes #允许root登录
PermitEmptyPasswords no #不允许空密码登录
PasswordAuthentication yes # 设置是否使用口令验证。
记得修改完配置文件后,重新启动sshd服务器(/etc/rc.d/sshd restart)即可。
famp5.1.0安装好后是以网页形式管理服务器的,当然里面也包括的有PHPMYADMIN,所以famp5.1.0与远程服务器的连接不仅仅是fanp5.1.0,还包括了PHPMYADMIN与远程数据库的连接。所以在实现famp5.1.0与远程数据库连接的同时也要让PHPMYADMIN与远程数据库连接。
下面我正式开始说说我的做法:
因为mysql的默认用户root是不能远程控制的所以我们要先在远程数据库上面建立一个用户名为famp的用户,密码为famp_pw(当然你也可以自己改别的,这里我用的都是famp5.1.0默认用户名与密码)。命令如下:
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘famp’@'localhost’ IDENTIFIED BY ‘famp_pw’ WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘famp’@'%’ IDENTIFIED BY ‘famp_pw’ WITH GRANT OPTION;
上面建立的是一个和root本地权限用户权限相同的用户,不过它可以远程控制数据库。
接着在建立一个名为sherry,密码为891028的用户用于数据库的远程控制。(当然你也可以直接用famp这个用户也行)
mysql> GRANT ALL PRIVILEGES ON *.* TO ’sherry’@'localhost’ IDENTIFIED BY ‘891028′ WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO ’sherry’@'%’ IDENTIFIED BY ‘891028′ WITH GRANT OPTION;
这个用户的权限和上面一个的相同。
先在我们在回到装famp5.1.0的服务器里。
首先要做的就是把本地数据库中的名为famp的数据库导出,因为后面要用到。
下来转到famp5.1.0的安装目录:
#cd /usr/loacl/famp/
编辑config.php文件
#ee config.php
内容如下:
<?php
/**
* 作者:爱洞特漏
* 说明:未经本人允许,不得将此软件用于任何商?用途!
*/
if(!defined(’IN_FAMP’)) exit(”Hi, Thank you for choose FAMP!”);
$dbhost = ‘192.168.56.103′;// 数据库服务器
$dbuser = ‘famp’;// 数据库用户?
$dbpw = “891028″;// 数据库苈
$dbname = ‘famp’;// 数据库?
$language = ‘chinese’;//语?
?>
把上面的localhost改成你的远程数据库服务器IP地址,如:
$dbhost = ‘202.112.56.90′;// 数据库服务器
下面的数据库用户名及密码就是刚才我们建立的数据库的用户名与密码,数据库名最好就不要改了,因为后面还要用到。
退出保存。
再转到phpMyAdmin目录下:
#cd cd /usr/loacl/famp/phpMyAdmin/
编辑config.inc.php文件
#ee config.inc.php
内容如下:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* phpMyAdmin sample configuration, you can use it as base for
* manual configuration. For easier setup you can use setup/
*
* All directives are explained in Documentation.html and on phpMyAdmin
* wiki .
*
* @version $Id: config.sample.inc.php 12304 2009-03-24 12:56:58Z nijel $
*/
/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = ‘cookies’; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! *
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = ‘cookie’;
/* Server parameters */
$cfg['Servers'][$i]['host'] = ‘localhost’;
$cfg['Servers'][$i]['connect_type'] = ‘tcp’;
$cfg['Servers'][$i]['compress'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = ‘mysql’;
/* rajk – for blobstreaming */
$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
$cfg['Servers'][$i]['bs_repository_threshold'] = ‘32M’;
$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
$cfg['Servers'][$i]['bs_temp_log_threshold'] = ‘32M’;
/* User for advanced features */
//$cfg['Servers'][$i]['controluser'] = ’sherry’;
//$cfg['Servers'][$i]['controlpass'] = ‘891028′;
/* Advanced phpMyAdmin features */
// $cfg['Servers'][$i]['pmadb'] = ‘phpmyadmin’;
// $cfg['Servers'][$i]['bookmarktable'] = ‘pma_bookmark’;
// $cfg['Servers'][$i]['relation'] = ‘pma_relation’;
// $cfg['Servers'][$i]['table_info'] = ‘pma_table_info’;
// $cfg['Servers'][$i]['table_coords'] = ‘pma_table_coords’;
// $cfg['Servers'][$i]['pdf_pages'] = ‘pma_pdf_pages’;
// $cfg['Servers'][$i]['column_info'] = ‘pma_column_info’;
// $cfg['Servers'][$i]['history'] = ‘pma_history’;
// $cfg['Servers'][$i]['designer_coords'] = ‘pma_designer_coords’;
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = ‘/etc/swekey-pma.conf’;
/*
* End of servers configuration
*/
/*
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = ”;
$cfg['SaveDir'] = ”;
?>
把上面的localhost改成你的数据库服务器IP地址就行了。
现在我们就可以用phpMyAdmin打开你的数据库了。
在浏览器地址栏输入你装famp5.1.0的服务器地址加端口号8888和phpMyAdmin的目录phpMyAdmin,即:
http://你的IP地址:8888/phpMyAdmin/
现在到了数据库的登录界面,输入刚才建立的sherry用户名与密码进入数据库管理界面,然后导入刚才导出的famp数据库,导入成功后就可以使用famp5.1.0了。
在浏览器地址栏输入你装famp5.1.0的服务器地址加端口号8888,即:
http://你的IP地址:8888/
现在就可以使用famp了,里面的数据库连接也可以使用。
至此,让famp5.1.0与远程数据库连接就做好了。
昨天刚用famp在FreeBSD虚拟机上装好了WEB服务器,但同时我又遇到了一个问题,就是我的虚拟机服务器上只能访问一个网站,因为只有一个IP地址,而且没有DNS服务器。然后我就想能不能通过一个IP访问不同的网站,经过我上网收索结果证明是可以的。就是用虚拟服务器,但是我们有DNS服务器,所以就只能用IP地址访问网站,经过我将几种方法的对比我觉得我只能通过不同的来访问不同的网站。
下面我就将我如何实现在不同的端口上运行不同的站点的方法介绍给大家:
(阅读本文章之前建议先阅读以下这篇文章:http://help.114la.com/Apache2/vhosts/examples.html)
以下是我的虚拟机中FreeBSD服务器装的软件:
Apache:httpd-2.2.11.tar.bz2
Nginx:nginx-0.6.36.tar.gz
Mysql:mysql-5.1.34.tar.gz
PHP:php-5.2.9.tar.bz2
Pureftpd:pure-ftpd-1.0.21.tar.bz2
ZendOptimizer:ZendOptimizer-3.3.X
eaccelerator:eaccelerator-0.9.5.3
GD:gd-2.0.35
我所用到的方法就是基于IP的虚拟主机
在我的实现过程中出现过很多问题,下面我就将我出现的问题说一说:
在我看到的所有方法中都是在httpd.conf(/etc/local/apache/conf)中借助在NameVirtualHost指令中定义端口的方法来达到这个目的。
即在httpd.conf文件中加入
Listen 80
Listen 8080
NameVirtualHost 172.20.30.40:80
NameVirtualHost 172.20.30.40:8080
<VirtualHost 172.20.30.40:80>
ServerName www.example.com
DocumentRoot /www/domain-80
</VirtualHost>
<VirtualHost 172.20.30.40:8080>
ServerName www.example.com
DocumentRoot /www/domain-8080
</VirtualHost>
<VirtualHost 172.20.30.40:80>
ServerName www.example.org
DocumentRoot /www/otherdomain-80
</VirtualHost>
<VirtualHost 172.20.30.40:8080>
ServerName www.example.org
DocumentRoot /www/otherdomain-8080
</VirtualHost>
但是经过我多次试验发现这样实现不了我的目的
于是我一点一点的把httpd.conf文件里面的内容看了一遍(因为这是配置文件嘛),看到最后一行我发现了Include conf/vhost.conf ,我一看vhost.conf不就是和httpd.conf在同一个目录下的一个文件嘛。
于是我打开vhost.conf,结果这是就是虚拟主机的配置文件,内容如下:
#————————- Mark: main User: aidong ——————-
<VirtualHost *:80>
Serveralias aidong.org www.aidong.org
ServerAdmin admin@aidong.org
DocumentRoot /home/ftp/aidong_main/wwwroot
ErrorDocument 404 //
DirectoryIndex index.html index.htm index.php
ErrorLog /var/log/apache_log_main
php_admin_value open_basedir “/home/ftp/aidong_main/:/tmp/:/var/tmp/”
<Directory />
Allow from all
</Directory>
</VirtualHost>
#————————- Mark: sherry User: sherry ——————-
<VirtualHost *:8080>
Serveralias
ServerAdmin admin@aidong.org
DocumentRoot /home/ftp/sherry_sherry/wwwroot
ErrorDocument 404 //
DirectoryIndex index.html index.htm index.php
ErrorLog /var/log/apache_log_sherry
php_admin_value open_basedir “/home/ftp/sherry_sherry/:/tmp/:/var/tmp/”
<Directory />
Allow from all
</Directory>
</VirtualHost>
分析上面一段配置文件就可以知道<VirtualHost :80>里面的就是IP地址,80就是端口号,于是我就想在网上找的教程里面让更改的配置文件是不是在这里,然后我就把*改成了我的IP地址,把第二个端口改成8080,再根据网上找的教程内容在httpd.conf文件里加入了
Listen 80
Listen 8080
NameVirtualHost *:80
NameVirtualHost *:8080
(上面*即是你的IP地址)
保存退出然后重启apache
# /apache-restart
现在就可以通过IP地址加端口号访问不同的网站了即ip地址:端口号
其实如果你的IP地址是动态的话以上的*就不用改了,这样的话你就可以用动态IP访问你的网站了
利用这个方法你可以添加更多的网站(只要端口号够用)
注:此方法适用于用famp装的服务器,自己手动配置的服务器没有使用过。
用最小化模式安装FreeBSD,不装apache,mysql,php,zend,pureftpd,如果装了,请将其删除!
用root身份登陆
第二步:(安装前的准备)
在这里要用到的软件有:
famp5.1.0.tar.bz2
多线程下载工具axel
perl-5.8.9.tar.bz2
先更换一下你的源地址:
# ee /etc/make.conf
MASTER_SITE_OVERRIDE?=\
http://ports.hshh.org/${DIST_SUBDIR}/\
ftp://ftp.tw.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/\
ftp://ftp.jp.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/\
ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/\
MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP}
接着安装多线程下载工具axel
# cd /usr/ports/ftp/axel
# make install clean ; rehash
安装这个这是为了下载速度更快
再接着安装perl-5.8.9.tar.bz2
# cd /usr/ports/lang/perl5.8
# make install clean ; rehash
第三步:正式安装famp5.1.0
先下载famp5.1.0
可以去:http://www.aidong.org/thread-223-1-1.html
或者直接下载:http://down.aidong.org/famp5.1.0.tar.bz2
用cd 进入到usr目录下
#fetch xxxxxxxxxxxxxxxxxxxxx/famp5.1.0.tar.bz2 (x代表网址)
下载完成后解压:
# tar xzvf famp5.1.0.tar.bz2
进入解压目录:
#cd famp5.1.0
现在开始安装:
#./install.sh
整个安装过程需要半小时左右(具体时间由服务器配置决定)
安装完成后你的服务器就配置好了
现在你就可以用界面管理你服务器上的主机了
具体方法:
在浏览器里输入:http://你服务器的ip地址.8888/
账号是:famp 密码是:famp_pw
数据库root和famp账号的密码都为:famp_pw
mysql的账号为:loveworking
换版本:
换mysql:用您的源码包代替famp中的源码即可(源码位于famp5.1.0/FAMP/mysql/下);
换php:用您的源码包代替famp中的源码包(源源码位于famp5.1.0/FAMP/php/下)后,安装famp。然后重装一次zend(现在的php版本为php5X,如果您换成php4X或非php5X版本,才需要重装zend)。
换apache:用您的源码包代替famp中的源码即可(源码位于famp5.1.0/FAMP/apache/下);