Charset errors Rsyncing between Debian and Windows 2003 Server (cygwin) - cygwin

I've been using rsync for a while for incremental rotating backups. The script runs from a Debian to a Windows 2003 server with Cygwin installed (version 2.2.1).
rsync -rlptDvih --partial --fake-super --delete --delete-excluded --exclude-from="$EXCLUDES_C" -e "ssh -p $PORT" $USR_ADDR#$BKUP_ADDR:$unit1/$SNAPSHOT_RW/$NAME_FOLDER/$PERIODICITY.0
When rsyncing files with some characters (like Ó, é,...) the charset conversion is not fine:
f.st...... g/Calidad/OLD/T#303#251cnicos/Acuerdo T#303#251cnico de Aseguramiento de Calidad 2016.doc
f.st...... g/Calidad/OLD/Analisis de riesgos/GESTI#303#223N DE RIESGOS COMPANYDICIEMBRE 2015 (WC).docx
I've already tried almost everything and can't figure out how to fix it. Seems that --iconv rsync parameter should be able to handle this, but I read that the additional "layer" introduced by Cygwin can make this useless. I've tried with --iconv and some charset (utf8 and ISO88591) but it didn't solve the problem.

Related

Rsync without password file without ssh

I would like to establish rsync between Windows 7 and linux server for file transfer. I am trying to make this as simple as possible. As topic, is there any way to use rsync without password file and ssh? I was searching for few days but only found solution with either password-file or ssh.
I am using:
Client Env
Windows 7
cwRsync 5.5.0
Server Env
Linux Redhat 6.3 Santiago
rsync 3.1.1
If you want to use rsync without using SSH at all, then you can do it using an rsync server.
It requires installing rsyncd on the Linux server, and setting up and configuring an always-running service, but there's a tutorial here (from 1999!) that says how to do it.
You can set it up to allow access without a username and password, but only do that within a trusted network! Note that, even with a password, there won't be any encryption, so use with caution.
on the source system:
vim /etc/rsyncd.conf
then add your path
[your_path_name]
path = /any_directory/your_path_name
comment = My fast rsync server
read only = yes
list = yes
start the rsync server
sudo systemctl start rsync
and on the destination server:
rsync -r rsync://X.X.X.X:/your_path_name ./my_directory/ --progress

Cannot Connect to Linux Oracle Databse with Perl Script after connecting with PuTTY

I have the following problem:
I currently connect to one of our Linux servers using PuTTY on my Windows 10 machine. If I use a ‘standard’ PuTTY connection I have no problem: I can log in and run my Perl script to access an Oracle database on the Linux server. However, recently I have set up a new PuTTY connection (I copied the original working copy used above). The only difference from the original is that I have entered the following in the section Connection->SSH->Remote command of the PuTTY configuration window:
cd ../home/code/project1/scripts/perl ; /bin/bash
(I have done this so I arrive directly in the folder containing all my scripts.)
I can still log into the server with no problems and it takes me straight to the folder that contains my Perl scripts. However, when I run the script to access the Oracle database I get the following error:
DBI connect('server1/dbname','username',...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc. at PerlDBFile1.pl line 10.
impossible de se connecter à server1 / dbname at PerlDBFile1.pl line 10, <DATA> line 1.
In addition, if I run the env command on the server the variable $ORACLE_HOME is not listed (If I run the same env command on the server with the standard PuTTY connection the $ORACLE_HOME variable is present.)
Just to note: Running any other Perl script on the server (that does NOT access the Oracle database) through either of the PuTTY sessions I have created works with no problems.
Any help much appreciated.
When you set the remote command in PuTTY, it skips running of .bash_profile that is present in your default $HOME directory. This is why you are getting the error.
To resolve it, either place a copy of .bash_profile in your perl directory, or add a command to execute .bash_profile in remote command
OK, I have the solution!...Thanks to everyone who replied.
Basically, I originally had the command:
cd ../home/code/project1/scripts/perl ; /bin/bash (See original post)
To get it to work I replaced the above with
cd ../home/code/project1/scripts/perl; source ~/.bash_profile; /bin/bash
I also tried:
cd ../home/code/project1/scripts/perl; /bin/bash; source ~/.bash_profile
But that did NOT work.
Hope this helps someone.
Gauss76

rsync from linux to windows without smb mount

I would like to use rsync to mirror a git repo from a linux machine to several Windows servers. What I'm seeing online so far are solutions that require you mount the Windows side using samba. ideally I would like to avoid that because it would require managing several mounts, not to mention security concerns. I've verified that I can at least ssh onto my test server. I have cwRsync installed on the windows server. I try the following command, but rsync doesn't seem to like the space in the path to the rsync executable.
rsync -rlH --rsync-path="c:/Program\ Files/cwRsync/bin/rsync.exe" . Administrator#cool03-stage:d:/rsync_test/.
'c:/Program\' is not recognized as an internal or external command,
operable program or batch file.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
After adding C:\Program Files\cwRsync\bin to my PATH on the Windows server, I can run this:
rsync -rlH -e ssh . Administrator#cool03-stage:/cygdrive/d/rsync_test/.
Seems to work.

Web browser not displaying the index.html in the htdocs directory - Apache

The installation path of my Apache web server is /usr/local/apache2.
I start the server using a apachectl start command and when i type localhost in my Web Browser it displays a Apache 2 Test Page powered by CentOS and not the index.html in /usr/local/apache2/htdocs. Does any one know the reason for this?
Also there are two conf.d files in my system. One is in /etc/httpd/conf and other one is in /usr/local/apache2/conf (where i installed Apache). Any reasons for this? Please help
Firstly, I'm guessing you have built apache from source - was there a specific reason for doing this? I usually find systems are a lot more manageable if you use the standard distribution packages or use new packages from other repos if you need later versions.
If you don't have a specific need for using locally-built apache, I'd recommend removing it then installing apache using the normal CentOS repositories.
Next (or first, if you are staying with the locally-built apache), run: httpd -V
For example, one of my systems returns:
[me#here ~]# httpd -V
Server version: Apache/2.2.3
Server built: Jun 6 2012 10:00:36
Server's Module Magic Number: 20051115:3
Server loaded: APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture: 32-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
The output will tell you where its true config file is, in this case /etc/httpd/conf/httpd.conf - that way you'll know which config is the one actually being used.
Once you know which config files are being used, you can check them to see where the document root is - it might be in /var/www/html/ instead of /usr/local/apache2/htdocs or just about anywhere.
When you know where the document root is, then check and make sure the files and directories are readable by apache (or whatever user apache is running as - the first column from ps aux | grep httpd will tell you that)
Next check the logfiles, typically /var/log/httpd/error_log and also the system logs in /var/log/messages and /var/log/secure
Lastly, if you are running a recent CentOS which has SELinux enabled, and you have built apache yourself you'll almost certainly be in a world of pain. You can try getenforce to see if SELinux is active, and setenforce 0 to disable it (for testing).

Using Psexec with Windows Server 2003

I'm trying to run a psexec command to a remote Windows Server 2003 machine. I run the following command:
psexec \machinename perfmon.msc -u machineadmin -p adminpassword -i -s
The -i and -s flags will allow me to run the GUI for perfmon.msc on the remote machine's desktop interactively.
I get the following error when I try to run the above command:
Couldn't Access machinename
Access denied
I'm using psexec version 1.94 and I'm certain that the machinename, user, and password are correct. Does anyone know if there are known issues with psexec on Windows Server 2003 and whether or not there is a fix?
[This question would be better fit for ServerFault.com, but nevertheless...]
A few suggestions:
Use two slashes before the machinename e.g. \\machinename (maybe that's what you meant the StackOverflow escaped the backslash)
*.MSC files are not usually directly executable remotely--you'll want to give the path to "c:\WINDOWS\system32\mmc.exe" and then the parameters
All parameters for psexec should go before the remote program and its parameters.
Is there really a reason to run the process as the System account ('-s') instead of just Administrator?
All together, it should look something like this:
psexec \\machinename -i -u machineadmin -p adminpassword "c:\WINDOWS\system32\mmc.exe" "perfmon.msc"
Are you connecting as an admin to the remote machine? The error says 'access denied'. You may not have the necessary privileges. Try connecting as an admin.

Resources