xcopy, net use not working from Linux machine - linux

I am trying to copy files from windows server to network shared folder via VPN . Here is my code from batch file. This is working fine without any issues.
net use \\servername\test_folder password /user:user_name
xcopy C:\Apache\htdocs\arul\xias \\servername\\test_folder
But when I try to run this from Linux machine it is not working. This Linux machine is also connected to network shared folder via VPN. So I tried below on Linux machine in .sh file.
net use \\servername\test_folder password /user:user_name
cp C:\Apache\htdocs\arul\xias \\servername\\test_folder
I am getting errors like net command is not found and cp: -r not specified;
How to achieve this from Linux machine ?

The commands "net use" and "xcopy" are specific to Windows and will newer work on linux.
You should use some smb specific commands instead (of course, the kernel must support them).

Related

I am trying to run hyperledger fabric sample test network on windows 11

when executing "/network.sh up", I got this:
-bash: /network.sh: no such file or directory
how can I fix this?
I need to get the network up
You say you are trying to run /network.sh. This will try to run a network.sh script in the root directory of your filesystem. More likely you meant to type ./network.sh, which will run a network.sh script in your current working directory (. is interpreted by the shell as the current directory).
You give no details of how your environment is set up so make sure you are following the guidance on running in Windows provided by the Fabric documentation:
https://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html#windows
Essentially the recommendation is to run on Linux within a (Windows Subsystem for Linux) virtual machine. I personally run Docker within the Linux environment too, and don't use Docker Desktop for Windows. Either approach should work.

windows subsystem Linux cannot find files in the terminal

When using window 10 system.
I have assessed the home directory of the WSL and manually move a python file into the following address
C:\Users\assa8\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\lxr\demo
However, the python file did not show up when I use the 'ls' command in the Linux terminal and I also could not run it using command lines. It appears the file did not exist when I tried to access it through the terminal.
How can I fix it?
Thanks
If you are using WSL1 then the recommendations are to not under any situations edit or modify any Linux files inside of your %LOCALAPPDATA% folder using Windows apps or tools which includes moving files using file explorer. See this blog post from Microsoft https://devblogs.microsoft.com/commandline/do-not-change-linux-files-using-windows-apps-and-tools/
If you are Using WSL2 that is a slightly different issue of which i cant help you right now as i am still using WSL1
You should do your dev work in the /mnt/c/ sub folders in WSL which will allow you to easily edit those same files on windows. Personally I work in a folder c:\projects\ which is mapped to /mnt/c/projects/ in WSL.

Need to create Linux Users from Windows Machine using Batch file or Script . I am having ssh access to server.

I am having several Linux machine in my DC and i need to create one script in Windows Server which will create users on Linux machines. Please suggest.
If you have OpenSSH installed, just run this in your batch file once per linux client:
ssh root#linux-machine "adduser user_name --home /home/user_name"
Try to give a look to expect for Windows. Like the Unix version, you can remotely execute interactive commands.

Using linux wget to grab data from windows box

I need to get the data from Windows box and store it on my linux box using wget.
#!/bin/sh
#
user="vim1"
pass="pass11"
host="10.20.15.124"
#from this folder
localbase="C:/Users/i1/Desktop/datafolder"
remotebase="/home/myfolder"
wget_opts="-q"
When I run
wget --user=vim1 --password='pass11' 10.20.15.124
it does nothing. Just says
Connecting to 10.20.15.124:80...
Can someone tell me why?
As already commented, if you don't have an HTTP or FTP server up and running on your Windows box you will have problems connecting to it through internet. Until you have resolved that, a relatively fast way to transfer your files would be through sneakernet if you have physical access to the Windows box.
As pointed out by #n.m. and #htor, you need to have an HTTP server running on your Windows machine to be able to connect this way. What you can do is use Samba to mount a shared folder from your Windows box on your Linux box and copy the files to a local folder on your Linux box (google buzzword: smbmount).
If by any lucky accident you have Python on your source machine, then you can use the preinstalled SimpleHTTPServer module to serve your file over HTTP. Go to the folder with your file and run
python -m SimpleHTTPServer
or if you have Python 3
python3 -m http.server
And then on your Linux machine use
wget http://<source-machine-IP>:8000/<filename>
The module allows to specify an optional PORT parameter, if the default 8000 port is not suitable for you.

Remote development - Edit on Windows & Build on Linux

I am looking for a solution for a remote development environment as follows:
Editor - Windows Source Insight / Visual Studio
Source control - Clearcase
Build server - Linux
The above can't be modified.
In my current setup, I can view and edit the sources on Windows using a Windows Cleacase client.
My problem is mainly the build (and the later on, the debug) process.
I need to invoke 'make' from Windows on a specific Clearcase view on the Linux Server.
I can login in a separate process using SSH to the Linux server and run 'make', but it is a cumbersome procedure.
I am also unable to view the 'make' results and double-lick them to go to the specific warning/errors.
Is there any way to remotely bind a Windows command/batch to a Linux environment?
Perhaps through SSH?
Thank you for any suggestion you might have.
The usual solution is rather a pull strategy (where your build server fetches information on Linux, rather than trying to pilot everything from Windows.
If you follow the SSH path, be aware of technote swg21351507:
Linux SSH connection hangs when attempting to exit after starting ClearCase.
This can affect the use of scripts to start/stop ClearCase remotely using SSH.
Cause
This is a due to a OpenSSH server design, which will not close the console until all process/jobs executed by the user are completed.
Refer to this SSH FAQ for further details, regarding background jobs.
Resolving the problem
Redirect the ClearCase start script to either /dev/null or to a log file.
Example:
/usr/atria/etc/clearcase start < /dev/null >& /dev/null
/usr/atria/etc/clearcase start < /tmp/ccstart >& /tmp/ccstart
Try sshfs. I don't if there is a sshfs client for windows. If not, you can try NFS, or even SAMBA. Those definately work in Windows and Linux.
I just came across this and wanted to answer, even if the original poster has surely resolved their issue. This could be quite easily resolved by installing a jenkins instance on the build machine. You could kick off the build from the web interface and have it pull the files from clearcase and tell you the results.

Resources