我的开发环境是linux,但是需要同时维护windows和linux的服务器,所以有时需要在linux系统下也能远程控制windows的机器。

rdesktop是一款开源的远程连接工具,它通过实现了Remote Desktop Protocol (RDP) 来支持远程windows的电脑。

rdesktop的官网:http://www.rdesktop.org/ 

 

rdesktop安装

sudo apt-get install rdesktop

 

windows配置

  1. 勾选允许远程协助连接这台计算机

  2. 选中允许运行任意版本远程桌面的计算机连接

 

打开远程

rdesktop -g 1340x650 -a 32 -r sound:local -r clipboard:PRIMARYCLIPBOARD -r disk:Frdisk=/mnt/share -u user_name -p password 192.168.1.3 &

-g 设置远程的分辨率,可根据自己电脑的实际分辨率设置

-a 设置色彩深度

-u 设置用户名(可选)

-p 设置密码(可选)

-f  全屏模式

-r 设备重定向:

  -r sound:local 可以将声音重定向到客户端机

  -r clipboard:PRIMARYCLIPBOARD 使主机客户机共享剪切板

  -r disk:Frdisk=/mnt/share 使客户端的/mnt/share挂截到windows的Frdisk盘

 

进入全屏模式后可以用 Shift+Ctrl+Enter 切换回非全屏

Keep it simple!

作者:KEITSI

出处:http://www.cnblogs.com/keitsi/

知识共享,欢迎转载。


今天用git pull来更新代码,遇到了下面的问题:

  1. error:Yourlocalchanges to the following files would be overwrittenbymerge:

  2.    xxx/xxx/xxx.java

  3. Please,commit your changesorstash them before you can merge.

  4. Aborting 

提示已经很友好了,从网友处得到的答案直接帮我解决问题。

1.stash

通常遇到这个问题,你可以直接commit你的修改;但我这次不想这样。

看看git stash是如何做的。

  1. git stash

  2. git pull

  3. git stash pop

接下来diff一下此文件看看自动合并的情况,并作出相应修改。

git stash: 备份当前的工作区的内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致。同时,将当前的工作区内容保存到Git栈中。
git stash pop: 从Git栈中读取最近一次保存的内容,恢复工作区的相关内容。由于可能存在多个Stash的内容,所以用栈来管理,pop会从最近的一个stash中读取内容并恢复。
git stash list: 显示Git栈内的所有备份,可以利用这个列表来决定从那个地方恢复。
git stash clear: 清空Git栈。此时使用gitg等图形化工具会发现,原来stash的哪些节点都消失了。

2.放弃本地修改,直接覆盖之

  1. git reset--hard

  2. git pull


 

yum -y install epel-release
yum -y install rear syslinux-extlinux grub2-efi-x64-modules bzip2 httpd backuppc telnet

#添加backuppc用户
useradd backuppc && echo "123456"|passwd --stdin backupp


#修改apache启动用户为backuppc
vim /etc/httpd/conf/httpd.conf
sed -i "s/User apache/User backuppc/" /etc/httpd/conf/httpd.conf
sed -i "s/Group apache/Group backuppc/" /etc/httpd/conf/httpd.conf

 
#修改所有主机均可访问backuppc控制页面
vim /etc/httpd/conf.d/BackupPC.conf
<IfModule mod_authz_core.c>
  # Apache 2.4
  <RequireAll>
    Require valid-user
    <RequireAny>
      Require all granted
    </RequireAny>
  </RequireAll>
</IfModule>


#添加加密用户
htpasswd -c /etc/BackupPC/apache.users  backuppc
注:这一步添加的用户是登录时的,密码自定义

 
#配置backupc主配置文件
vim /etc/BackupPC/config.pl
$Conf{CgiAdminUsers}     = 'backuppc';  (配置backuppc账号为bckuppc)
$Conf{ServerInitdPath} = '/etc/init.d/backppc'; (启动命令)
$Conf{ServerInitdStartCmd} = '$sshPath -q -x -l root $serverHost$serverInitdPath start';
$Conf{PingPath} = '/bin/ping';
$Conf{Language} = 'zh_CN';  (更改web页面为中文)

#启动httpd和backuppc服务
systemctl restart httpd && systemctl restart backuppc

 

web端登录

注:登录账号是上面使用htpasswd命令生成的用户和密码。

#首次进来是下图这样

 

web端添加需备份server:
点击左侧“增删客户机”后,选择“客户机”,在下侧窗口“添加”指定server IP,这里测试用172.16.186.132,账号为backuppc(可为其他),然后点“保存”

 

 

保存后刷新页面,在web最左侧选择"客户机报告"---在最下面点击刚添加server IP在左侧Server IP下选择“修改服务器设置”,开始对其设置备份规则:

#备份/opop目录,如下图

#备份/opop下的所有(星号匹配所有)

 

#在172.16.186.131上操作(.ssh目录权限任何都不要改)

186.131端SSH免密登陆设置

 

#172.16.186.132端配置

[root@client2 ~]# mkdir /opop

 

客户端上执行

[root@client2 ~]# yum -y install rsync
[root@client2 ~]# systemctl start rsyncd
[root@client2 ~]# systemctl enable rsyncd

#测试

[root@client2 ~]# cp -r /boot/ /opop/

 

在浏览器上点击左上角“172.16.186.132主页”,然后点击“开始完全备份”,如下图:

#点击"开始完全备份",即可开始完全备份,如下图

#选左侧的“浏览备份”,见下图

 注:上图中也可以选择恢复文件

该链接为以上配置参考

 

 

 

同步widows请参考:https://www.cnblogs.com/kevingrace/p/5972563.html

 


Has anyone gotten BackupPC to work properly using Apache running under a username other than 'backuppc'?

I followed the instructions here:
Wiki

But the server returns a 500 error when accessing localhost/BackupPC_Admin, with the following in my apache error_log:

[Tue Dec 30 14:01:38.891706 2014] [authn_file:error] [pid 2114:tid 140026226648832] (13)Permission denied: [client [redacted wan ip] AH01620: Could not open password file: /etc/backuppc/backuppc.users
[gregory@seneca cgi-bin]$ ls -l
total 8
-rwsr-x--- 1 backuppc http 6768 Dec 30 13:08 BackupPC_Admin
[gregory@seneca lib]$ ls -l /etc/backuppc/
total 92
-rw-r----- 1 backuppc backuppc    46 Dec 30 13:38 backuppc.users
-rw-r----- 1 backuppc backuppc 85105 Dec 30 13:37 config.pl
-rw-r----- 1 backuppc backuppc  2214 Aug 19 08:06 hosts

My web server does function as I'm currently using it to host an ownCloud installation as well as a koken installation.

Any insight would be appreciated -

Thanks,
Greg

EDIT: SOLVED

In order to get things working in my particular setup I had to

1) chmod 755 /etc/backuppc/*
2) In /etc/conf/httpd/extra/backuppc.conf
2.1) comment out the 'Require' option in the <Directory /usr/share/backuppc/cgi-bin> directive
2.2) change the 'Require' option to 'Require all granted' in the <Directory /usr/share/backuppc/html> directive

Last edited by rollenwiese (2014-12-31 01:43:30)


环境:Centos7.6、Backuppc
安装:(host:192.168.3.11)

[root@localhost ~]# yum install backuppc -y12

配置

[root@localhost ~]# vim /etc/httpd/conf/httpd.conf (修改apache启动用户为backuppc)
User backuppc
Group backuppc
[root@localhost ~]# vim /etc/httpd/conf.d/BackupPC.conf(修改所有主机均可访问backuppc控制页面)
<IfModule mod_authz_core.c>
  # Apache 2.4
  <RequireAll>
    Require valid-user
    <RequireAny>
      Require all granted
    </RequireAny>
  </RequireAll>
</IfModule>
由以上配置文件可知apache user文件为如下:
AuthUserFile /etc/BackupPC/apache.users
[root@localhost ~]# htpasswd -c /etc/BackupPC/apache.users backuppc
(这里密码设置为12345)
[root@localhost ~]# vim /etc/BackupPC/config.pl(配置backupc主配置文件)
$Conf{CgiAdminUsers}     = 'backuppc';(配置backuppc账号为bckuppc)
$Conf{ServerInitdPath} = '/etc/init.d/backppc';(启动命令)
$Conf{ServerInitdStartCmd} = '$sshPath -q -x -l root $serverHost$serverInitdPath start';
$Conf{PingPath} = '/bin/ping';
$Conf{Language} = 'zh_CN';(更改web页面为中文)
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# systemctl restart backuppc12345678910111213141516171819202122232425

web测试
在这里插入图片描述
web端添加需备份server
点击“增删客户机”后,选择“客户机”,在右侧窗口“添加”指定server IP,这里测试用192.168.3.12,账号为backuppc,然后点“保存”
在这里插入图片描述

在这里插入图片描述
保存后刷新页面,选择刚添加server,选择“修改服务器设置”开始对其设置备份规则:
在这里插入图片描述
在“RsyncShareName”一栏输入需备份路径,这里设置为/test;然后再BackupFilesOnly一栏输入“*”,表示备份/test目录下所有文件,当然也可指定文件,然后点击保存:
在这里插入图片描述
SSH免密登陆设置

[root@localhost ~]# cd /var/lib/BackupPC/
[root@localhost BackupPC]# mkdir .ssh
[root@localhost BackupPC]# chown backuppc.backuppc .ssh
[root@localhost BackupPC]# chmod 700 .ssh
[root@localhost BackupPC]# chmod 700 .ssh
[root@localhost BackupPC]# su -s /bin/bash backuppc
bash-4.2$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/BackupPC/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /var/lib/BackupPC/.ssh/id_rsa.
Your public key has been saved in /var/lib/BackupPC/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:1dWLzmcZ22P8oz4oXHvCd145490rY0JVUoCuoR8vp6A backuppc@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
|            ..+o |
|           o o ..|
|          o . + .|
|         o . o o |
|        S o + . =|
|       . o o o Oo|
|       .o * o +++|
|      . .= O B.oB|
|     E   .= BoB+=|
+----[SHA256]-----+
bash-4.2$ ssh-copy-id root@192.168.3.1212345678910111213141516171819202122232425262728

对目标server操作

[root@localhost ~]# mkdir /test
[root@localhost ~]# useradd backuppc
[root@localhost ~]# passwd backuppc
[root@localhost ~]# chown -R backuppc.backuppc /test1234

测试

[root@localhost ~]# cp -r /boot/ /test1

点击“192.168.3.12主页”,然后点击“开始完全备份”,即可开始完全备份:
在这里插入图片描述
点击“浏览备份”,即可查看所备份文件&目录,这里可以选择部分恢复或者全部恢复:
在这里插入图片描述