Samba, Apache and SVN. Getting the permissions right - linux

I have two machines I work on:
Windows Client (Development Machine)
Linux Web Server (Ubuntu)
On the Linux server I have installed Apache, Samba and SVN.
I've created a samba share that maps to the htdocs/ directory so that I can access the web files from Windows.
The following illustrates my workflow:
From command line on Linux server I checkout working copies of web projects from remote server into my local Linux server's htdocs directory.
On the Windows machine I access these files (using samba) and edit them in my editor and test them in the web browsers
Back on the Linux machine I checkin my work to the remote server.
The problem I have is that currently for me to be able to edit the files on the Windows box via Samba I have to change the owner of the files to nobody (apache user) and set the Samba share to use SHARE permissions.
When I try to use SVN to commit and update etc. I can't because my Linux user is not 'nobody' and does not have permissions to do so. So I have to become root do an SVN [command] then change all the files back to 'nobody' so that I can't edit on Windows.
What I would like to be able to do is have the web files be owned by my local Linux user which would enable SVN commands to work and for Windows (over samba) to also use this same user.
How can I get this to work, is there a way to get Windows and Linux users to match?

Why use this strange workflow? A more logical one would be:
Checkout the files on the Windows Machine directly
Edit and test them
Check in when ready
Is there something special you need from the Linux server? Cant' you install apache on Windows (for testing purposes only?)

I've solved my problem by changing all the permissions to match and then using samba USER permissions and settings up a users.map file.

Related

scp from Linux to Windows: 'C:\Program' is not recognized error

In my linux machine, I'm trying to send a file over to a Windows machine via:
scp fileNameA user#windowServer:fileNameA
I get the following message:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
What's prompting this message?
I've installed OpenSSH on the windows machine, and I can successfully SSH into it. I don't want to use WinSCP, FileZilla, etc, because I have to automate this in a script. This has to be done from the Linux machine, so I'm not interested in doing pscp from the Windows machine.
I have met the same problem today.
I think it is an issue in the new version of OpenSSH, which was published few days ago. I reverted previous version (v7.6.1.0p1-Beta), which was working correctly on my VM from https://github.com/PowerShell/Win32-OpenSSH/releases and problem was fixed without any changes in configuration.
I just fixed the same problem by moving my installation of OpenSSH from C:\Program Files\OpenSSH to C:\OpenSSH.
I had to first uninstall it properly using the provided script in Win32-OpenSSH and then follow back the information provided there https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH but only changing the path to C:\OpenSSH.
I met a similar issue today, trying to copy files to a Windows server running OpenSSH-Win64. I solved the problem by adding C:\Program Files\OpenSSH, which is the recommended installation location, to the Windows path:
Open the Control Panel, go to the System and Security section and open up System.
Click on Advanced System Settings and, in the System Properties dialog box, click Environmental Variables.
In the System Variables section of the dialog box, select Path and click Edit....
Click New, add the OpenSSH folder path and click OK to apply the change.
Then, do not forget to restart the OpenSSH service, either in the service management console or by running net stop sshd, followed by net start sshd in an elevated console.

Jenkins deployment from linux server to windows server

In company i have 3 servers, 2 linux servers and 1 windows server. I build .war on Linux server and i want to deploy it on second linux and windows server, for linux i use deploy plugin and it doesn't support version of tomcat8, and also it doesn't have option deploy war on windows server.
So my idea is to deploy war to samba directory then use copy script to obtain .war file. For windows i can use samba folder and in tomcat configuration use a deploy Application from a Local Path. Is there some more gentle solution of this problem ? If there some risk from using that solution ?
Edit:
In case when I try to use mounted directory, i use docBase="//ip/directory" and path="directory" i obtain error with The main resource set specified [\ip\directory] is not valid. I'm curious is even possible to do this ?
So if someone will face the same problem that is the solution:
On Jenkins server install plugin to execute shell scripts. That allow us to run cURL command.
To deploy .war on Windows server use command with cURL, example:
curl -T /var/lib/jenkins/jobs/(Path to war ) http://user:password#ip:port/manager/text/deploy?path=/(nameOfWar)&update=true
Also add role manager-script to your Tomcat user.
For deploy on Linux servers I use plugin Deploy war/ear to a container. So it's all in Jenkins and Tomcat.

How to copy files from windows to linux (cross platform)?

I want to trigger command/script from Linux environment which copies file from windows system to my Linux environment.
I have set up local Linux server for my web application. I am using WinSCP for file transfer and Putty as a console.
I want to automate the process of build deployment of Linux server.For that i have to copy build which is on my windows machine and paste it in my local Linux server so that i can deploy it.
As per my understanding, there should be some shared location which is accessible from Linux environment.
Is there is any script available for this? Also, please tell me the configuration changes require to do this.
You can use synchronize command of winscp from your windows,
winscp synchronize command
or winscp.exe command from your command prompt.
winscp.exe command
Install cygwin and you can use scp, ssh etc just like you would on linux. Besides, you can use ordinary bash scripts instead of crappy bat-files.
OR
http://www.codingepiphany.com/2014/01/13/batch-script-for-transferring-files-from-windows-machines-to-linux-file-server/
OR
Use samba
you can use rsync for synchronize your files. http://linux.die.net/man/1/rsync

Windows git client over ssh for local repository?

I have a set-up where I have a remote git server, a local git/development machine running Linux, and a Windows development machine.
I generally use putty from windows to log into my local linux development machine, which is where my local git repository resides, as well as where I do my compiling, etc.
I'd like to use a (gui) git client on my windows development machine to manage this git repo, particularly for visualizing branches, etc, since my linux machine is mostly headless.
It it possible to control it using a windows git client via SSH, so that I can use windows to manage my local git repository on my linux dev machine? I don't want to have a repo on both my windows and linux dev machines, and I don't want to go through a two-stage push process.
My other option I suppose is to add my linux machine as a network drive under windows and connect that way, but it's awfully slow.
(And if anyone has any recommendations for which windows client is good and can do this, please let me know. I'd like to use SourceTree, but I don't think it's capable of this)
Thanks!

How do I install XAMPP in a remote server?

I recently opened up a webserver in Amazon EC2. I managed to log in to the server using SSH with my mac. I also managed to install the EC2 API tool provided from Amazon. I have the XAMPP installation on my desktop. And I opened up a linux instance. I don't think I have a EBS(Elastic Block Store) mounted to the instance yet, I don't know how to do that. But How do copy the XAMPP installation file from my desktop to the server instance? Pls give me step-by-step instructions
I manage to solve my own question. I was using the scp protocol to transfer the XAMPP installation file. More info on this link: Secure Remote Logins and File Copying. This is the first time I used it, but you just type the command: scp -i ***.pem ec2-user#some_public_DNS /The/file/on/your/desktop. The file will then be transfer in a secure way to the remote server
I'm curious as to why you'd try to put XAMPP on an EC2 instance instead of simply using your system's package management system (e.g., yum, apt-get) to install what you need. This just seems like trying to hammer nails with the back of a screwdriver.

Resources