Backup from linux to Windows Server - linux

I have a Debian server (VPS) and a Windows server (at home). I would like to backup periodically some paths of my Debian to My Windows server. My WS act as NAS and I use it for my all backup.
Firstly I started to configure a cron task with rsync on my Debian but as there is no native ssh server on Windows server it may not be the best solution. Then I was wondering if it would not be better to use my windows server to pull data from my debian to windows.
Here is the only link I found that make things on this way: http://troy.jdmz.net/rsync/
(server pull from client)
Also my windows server is at my home and it bring one constraint which is that I can change my home location, so my ip change too and all the configuration of router. I would like to just plug the windows server and let it continue to work normally.
What do you guys think about all of that ? Is it an elegant solution to make this on this way ?
Do I have to install cygwin with rsync ? Is it possible to set a periodic task on my windows server ?
Thanks in advance.

As you pointed out in your question - being that your Windows machine is behind a NAT router, it may be simpler for your windows machine to 'pull' files from your Debian VM, as opposed to your Debian VM 'pushing' files to your Windows machine. Pushing files from your Debian VM to your Windows machine would require you to setup some type of server on your Windows machine that would listen for incoming connections from your Debian VM on some designated port, it would required that you setup a port-forwarding rule on your NAT router, and it would require you to setup a dynamic DNS hostname that would change whenever your router's public IP changes. And, since you would be opening a port up to the public, it would also require you to take into account security considerations to make sure that nothing gets compromised.
So, pulling files to your Windows machine from your Debian VM would be simpler. One way to do this would be to install Cygwin and use rsync, as you mentioned. Another solution may be to install putty on the windows machine, then use pscp on the windows machine to copy files from the remote debian host to the windows machine. The pscp command can be scripted using a DOS batch script, Powershell, or any number of other windows scripting tools. See http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter5.html for more info.

Related

Is there a way to directly edit a remote Linux server's code base through MS VS Code on my local windows machine?

Currently I manipulate the remote server through bash commands over putty, SSH w/ x11 forwarding and am messing with the web app locally and when I'm interested in deploying to the remote server I push the files over using a GIT repo.
My local machine is a MS Windows 10 with linux subsystem and the remote machine is a linux machine with Ubuntu 16.04.3 LTS.
This leads me to my question of is there a way to directly edit a remote Linux server's code base through MS VS Code on my local windows machine?
Thanks!
John
Hmm, this really looks like an x-y problem. More exactly, I do not think that you really want what you have asked.
In order to edit remote files with a local editor, the canonical way is to mount the remote file system (or a part of it) and then use any local tool. Samba allows to export a Linux folder as a Windows share, so you could easily go that way. The problem is that an IDE will try to compile and run the program locally on the windows system, which is probably not what you want. In addition, you will by default use Windows end of line convention (\r\n) instead of Unix one (\n), and cp1252 charset instead of utf-8.
IMHO, you should stick to x11 forwarding and use tools directly on the remote Linux box. The only acceptable use case I can imagine would be if the remote was a production system that you do not want to clutter with development tools, but in that case, I would strongly advise you to setup a local Linux dev. system and use it through x11 forwarding.

Is it possible to set up a GitLab Linux server and work off Windows PCs?

I'm looking at setting up a gitlab server (using a linux machine) with several devs on Windows PCs using it. I basically wanted to know if that's possible? I can't seem to find a definitive answer!
Thanks!
Yes, it's definitely possible. I'm using just the same - GitLab hosted on a Linux server while devs are on both Windows and Linux (VMs running on Windows).
Techically, there's no difference to it. You use SSH and HTTPS for client-server communication which are standard platform independent protocols. It's the same as using github.com, gitlab.com or any other such provider from any operating system.
The place I work has Gitlabs deployed can be on a linux server, while developers can be on either Windows or Linux desktops.
Git makes use of SSH and to connect to remote clients and Windows doesn't support SSH out of the box, however the installer for git comes bundled with all the features you will need to run a shell and connect to a remote server via SSH on windows. It also includes a basic UI, Git-Gui. You can download the installer from http://git-scm.com.

Remote commands execution and file acces in Linux and Windows

Suppose I have a server application installed in a few Linux and Windows machines. Now I would like to control it remotely. That is, I would like to start and stop the application, update the application configuration files, reads the logs remotely.
It looks to be easy in the Linux worlds. I can use ssh, scp, and probably nfs to execute commands in remote Linux machines and access files there. The problem is that I would like to execute commands and access files in remote Linux and Windows machines uniformly from a Windows machine. I need also some scripting capabilities too.
What is the best way to do that?
You can try to use cygwin http://www.cygwin.com/ on your windows machines and install a ssh server with it.
If you need graphical tools, use VNC
there is an OpenSS implementation targeting Windows at http://sshwindows.sourceforge.net/download/
since there is (besides Cygwin/MinGW) no possibility to run bash code (ksh/csh/tcsh code as well) you should make yourself familiar with the windows scripting host.

How Can I connect to Amazon Linux instance using Remote Desktop from Windows 7?

I created an EC2 Amazon Linux instance (yes, an amazon version of linux..)
it is launched but I can't connect using Remote Desktop...
am I trying to do something crazy here?
I got a message that Remote Computer is not available on the network
If you mean Windows RDP (Remote Desktop) that is your problem. Most likely you will need to use an SSH client to connect. I suggest Putty.
You should've received an SSH key when you setup your server. You will need to convert that key using PuttyGEN (same page as the Putty download) to convert it then use it with Putty to access the server.
Trying to walk you through the process of installing a GUI and VNC on the server is a bit much for here but give this video a shot. It seems pretty thorough and from skipping through it I saw no obvious errors in his process.
Try installing the vnc4server package. Then you can use a client such as TightVNC to connect from a Windows machine. You'll also need to open up port number 5900 in your firewall, which is the default for VNC.
You'll also have to have a desktop environment installed on your EC2 instance - by default you may only have the server packages which will not give you a GUI.
For your information, some folks posted remote desktop conf for EC2 instances.
http://activeintelligence.org/blog/archive/remote-graphical-linux-desktop-on-ec2/

Is it safe to use a virtual server as dev environment, symlinking to files on the host?

I used to use MAMP (or just a local Apache/PHP/MySQL stack) to work on web projects. I've since graduated to a live Ubuntu server which is much closer to the production environments for the sites I work on.
Now I'm trying to take this a step further to optimize my workflow. My goal is to have a Linux server running in VirtualBox that automounts a local folder share (from the host) and uses a symlink to gain access to the files (i.e. client:/var/www/dev is a symlink to host:/Users/charlie/dev/).
I don't want to keep my files stored on the virtual server if it can be avoided. I prefer having direct local access to the files and not having to wait for buffering issues between the host and the client. i.e., if I have several files that are located on the client open in my IDE and I close my laptop, as soon as I open it there's a bit of a buffer issue. My IDE has open project(s) that reference folders and files located on a network share that isn't yet available. In the few seconds it takes for the virtual machine to wake up, OSX is already reporting that the share can't be found and was disconnected, the IDE chokes up, etc.
So what am I asking? Well, is this safe / are there obvious pitfalls I'm not seeing / better ways to do this?
Edit: For anyone that stumbles upon this post, the final setup is a Linux virtual machine running in VirtualBox on a Mac with NFS and a symlink from my Apache web root to my mount.
I used NFS Manager (http://www.bresink.com/osx/NFSManager.html) to setup the NFS Server on my host computer with user mapping to my primary account. This ensures that when my VM mounts the NFS share it can do whatever it needs (reading, writing, modifying). Then I added this line to /etc/fstab on my VM to automount the share on boot: "123.456.89.1:/Users/charlie/nfs_share /mnt/nfs_share nfs" (where 123 is my host IP on the virtual NAT).
The result is a killer development environment where I can use Finder, Aptana (or whatever your editor of choice is) Photoshop, etc to work on files locally and simultaneously test them out in my "real" Apache/Lighttpd/MySQL/PHP environment!
I am using the exact same setup for accessing my documents folder between my Ubuntu host and the windows guest. Idem on my iMac. The only issues are when editing on the 2 platforms are the CR/LS, but that will be no issue on your setup.

Resources