How to transfer file from Ubuntu to Windows using Python [closed] - python-3.x

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to perform automation for transferring the file from Ubuntu(Linux) to Window system using python. I'm stuck with how I can implement this. Can anyone please suggest me a way to implement this.
My input for this will username, password, and windows path for the script.

You don't explain what transfer files mean, and if you want to transfer on the same computer (having a Windows file system and a Linux one on two different disk partitions) or on two different ones. You should think in terms of network communication protocols and file systems.
For remote file transfer, think in terms of network communication protocols : you might consider using rcp or scp or HTTPS or HTTP or rsync or to transfer the files (see this and that). Take into account cybersecurity considerations, so consider Python cryptographic services. You could also consider network file systems such as NFS or CIFS (a.k.a. SMB) or sshfs. HTTP and HTTPS and SSH protocols (both client and server side, look also into libssh) which is widely supported by Python or Guile bindings.
For local computer transfer between different disk partitions, think in terms of file systems, you could consider mounting the other's OS partition. Be then aware of VFAT or NTFS and CIFS support in Linux, and Ext2fs and NFS support on Windows.
You can code in Python (with pycurl and/or other Internet protocols) or Guile quite easily web services. Be aware of SOAP and REST (and SMTP to send emails). You could be interested by WebSockets to code a nice web interface. You may be interested by Python or Guile bindings to SMTP client libraries, HTTPS or libssh server or client libraries.
Consider also using distributed version control systems such as git - with a remote repository. Of course you'll find pygit2, a Python binding to it, and of course git is running both server side and client side on both Windows and Linux.
Be also aware of legal licensing considerations mentioned here.

Related

Remotely install Linux on Windows xp using TeamViewer [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
Our customer has about 800+ computers running Windows XP distributed across the country. Each computer can be accessed using TeamViewer. The goal is to replace XP by a Linux distribution remotely.
Does anybody know if this is possible, and where to start?
Thanks!
PXE is your only realistic hope:
Some on-site assistance is needed to press F12 at Bios before Windows XP boot:
A) On PC-A, setup DHCP server that refer DHCP-client to PXE server that download Linux ISO from a web server (of course all three can be a Windows machine in the same LAN segment onsite)
B) reboot PC-B onsite to reboot machine and press F10-F12 to choose Boot-options
C) then choose network-boot (PXE-Boot)
further reading : https://www.vercot.com/~serva/
guide: https://youtu.be/nnxgFpUr1Og?t=39
Note: Make sure you have enabled proxyDHCP and not DHCP Server
I would try with something like these:
Clonezilla, which works by replicating a previously prepared disk image to one or more computers booted inside a network segment
Cobbler, which works like a provisioning server for Linux based machines
Of those options, I have used Clonezilla with success. As long as the prepared base image doesn't change too frequently, the main time consuming tasks would be related with configuring the Clonezilla server and building that seed image.
I did a basic test of Cobbler and it worked fine in my environment, being this a way that would be more apt to deal with requirement changes.
Please also note that both options require some network configuration, like DHCP server settings that work with the PXE protocol.
Also, for your requirement, someone, a human being, would be needed to execute one or more of these tasks:
Properly enable network booting in the BIOS of each of the 800+ machines, unless it has already be done before
Boot the machines to install the new operating system
The network booting option, based on the PXE specification, should be supported by the motherboard of those machines and have higher booting priority than other devices, like CD drives, hard drives, etc.
Another thing to consider for the couple of options I'm suggesting, is how are those 800+ distributed across the country. The more disperse they are, the more cumbersome this task will be. Quite contrary, if there are few places were those machines are located, the more feasible this task will be; for example, by preparing and testing a server, computer or laptop that you then carry to each of those few places and installing the new operating system.
Regarding the option to boot using the public Internet to reach a remote deployment server, I don't know about how that could be done; in fact, for me that would be something quite interesting to learn about. If something like this is possible, another variable to note is the hardware compatibility of the destination machines, because as far as I know, protocols like PXE do some kind of multicast or broadcast in the local network segment and I presume those 800+ machines don't have recent motherboards with advanced firmware that could support more modern boot protocols.
That's all for now.

How to run firefox program in linux and get its output on windows [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have one centos 7 (minimum setup) installed on cloud .
I m connect it using using putty on my laptop.
I have installed Firefox on centos server which has fast internet connection.
However whenever i run Firefox its not loading because it doesn't have GUI installed (and i m connecting it using putty).
I want to browse internet on it from windows machine. How can i go about it?
Error Message
# firefox
Error: GDK_BACKEND does not match available displays
Please help
You need to supply Firefox with a virtual graphic screen. You could for example install XMing on Windows, and configure PuTTY to "forward X connection".
Then Firefox will "draw" on the screen, and the screen will be transmitted to your PC. Your mouse and keyboard signals will be transmitted to the remote server.
This setup should go about six times as slow than your current Web connection, since your connection to the Internet, which is the bottleneck, is unchanged, and now you're pushing massive X data on it instead of browsing elements.
A better possibility would be to install Squid proxy on the remote server, then configure your PuTTY to open a "tunnel" from remote port 127.0.0.1:3128 to local port 3128, and finally instructing your Windows Firefox to use 127.0.0.1 on port 3128 as proxy for all protocols.
This way, the browsing information will be downloaded remotely, compressed and forwarded to you.
This should be around twice as slow as your current connection (unless you're connecting with old Web sites without gz/deflate support, and mostly text with no images. In that case you might experience a connection up to five times as fast, albeit with a somewhat increased latency.
(An even better but even more complicated setup involves running a local proxy, connected through SSH tunnel to a remote proxy).
In all cases your navigation might appear as coming from the remote machine, but to ensure there's no information leak, you need to properly configure the proxy.
Use the below command to connect
$ ssh -Y whatever.com
On the Centos server, edit the file /etc/X11/sshd_config, it will be necessary to turn on X11 forwarding with a line like
X11Forwarding yes
In the putty Enable X11 forwarding in the configuration.
You can forward X over SSH, but it is painfully slow. Something like NoMachine will do far better.
However, if you are trying to get faster internet, you may be out of luck as any attempt to improve this will just add overhead.
You may be able to set up a VPN to improve the compression on data you receive from other websites. Take a look at this SO post for some information about what's available and what solutions already exist.

Windows program to communicate with Virtualbox

I am wondering if it is possible to write a program on Windows that communicates with a program within a Linux Virtualbox on the same machine. If this is possible, what is the best approach to doing this? Is there a way to do this without using the internet to communicate?
I found instructions showing how you could potentially use SSH, but I have never tried doing this before, so I do not know if using SSH to communicate would be the best option.
I was going to put this as a comment to a very vague question, but then it got too long.
It depends what you mean by "communicate"....
If the Windows machine should start a program on the Linux VM, you probably want plink.exe - see here.
If you want to transfer whole files, you probably want scp or FTP or FileZilla - see here.
If you want to send small messages occasionally, maybe netcat, also known as nc - see Netcat Cheatsheet here.
If you want full-on, high speed, continuous messages, maybe sockets or some messaging protocol like mqtt.
If you want to share data structures, like lists, queues or sets, you could allow both Windows and the Linux machine to access a shared Redis database - see here.
Or maybe it is enough to share a filesystem between the two machines - in which case you can make a Shared Folder in VirtualBox on your host and the VM can just mount that and read/write it. See diagram:

Virtual environment for Linux Kernel hacking [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
This question is to practicing Linux kernel hackers:
Generally, it is best to test/play with linux kernel changes/hacks in a virtualized enviroment.
What virtual environment do you use for testing your hacks?
How do you make a minimalistic filesystem(with basic utils) to use with the environment. If you are using a readymade filesystem, what is that are you using?
Useful heuristics you do with your environment(like installing a new kernel, sharing files etc?
Please provide a step by step procedure to setup the environment, if possible.
A collection of this info doesnt seem available in web.
Thanks.
Different people use different set ups, I don't think there is one true answer.
I currently use VirtualBox as Hypervisor with a file system created with Buildroot.
Apart from other VMs (kvm, qemu, vmware etc.) you could also use User Mode Linux to much the same effect if your hacking is in the more "logical" layers of the kernel.
I'm currently using a Fedora14 VM running in QEMU/KVM on a Fedora14 host for my network driver development. I use a fairly standard install with the Software Development packages, plus whatever web or networking tools (e.g. wireshark) might be useful for the task. I typically set up a serial console on the VM and monitor it with minicom on the host - this helps me catch stack traces when I'm chasing a bug. I usually have my source and editing environment on the host machine with the files on an NFS file system that the VM mounts - this way I don't have to keep copying files to and from the VM. With the host running the same version kernel, I can compile the driver quickly on the multicore host and test it in the VM.

How do I mount a remote Linux folder in Windows through SSH? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'm a blind student currently in a system admin/shell programming class. Although ssh works fine for executing commands like ls, pwd, etc editors do not work well with my screen reader and an ssh session. I was wondering if it is possible to mount a Linux folder over ssh so it appears as a windows drive? This way I could edit any files I needed to with accessible software and not have to constantly use SCP to send files back and fourth.
Back in 2002, Novell developed some software called NetDrive that can map a WebDAV, FTP, SFTP, etc. share to a windows drive letter. It is now abandonware, so it's no longer maintained (and not available on the Novell website), but it's free to use. I found quite a few available to download by searching for "netdrive.exe" I actually downloaded a few and compared their md5sums to make sure that I was getting a common (and hopefully safe) version.
Update 10 Nov 2017
SFTPNetDrive is the current project from the original netdrive project. And they made it free for personal use:
We Made SFTP Net Drive FREE for Personal Use
They have paid options as well on the website.
Dokan looks like a FUSE and sshfs implementation for Windows. If it works as expected and advertised, it would do exactly what you are looking for.
(Link updated and working 2015-10-15)
The best an easiest solution I found is https://github.com/billziss-gh/sshfs-win, connected servers shows up as a fully functioning network drives. This is not a 'Dokany' or 'dokan' based solution which from experiance seems more stable and performant, also see WinFsp Performance Testing.
Please note previously this answer stated, https://github.com/Foreveryone-cz/win-sshfs and before that http://www.swish-sftp.org/ but I no longer use any of them, first one stopped working second one created drives not fully supported in all programs.
Another, more Windows-y option (for $39) is http://www.expandrive.com/sftpdrive
Take a look at CIFS (http://www.samba.org/cifs/). It is a virtual file system you can run on your linux machine that will allow you to mount folders on your linux machine in windows using SMB.
CIFS on linux information can be found here: http://linux-cifs.samba.org/
You need to mount a remote share on your windows machine. This is what Samba/smb is for.
What you'll be doing is turning your Linux box into an SMB server, which lets it share files in a way that plays nice with Windows.
If you're not on the same network, you'll need to tunnel this through your SSH connection which may not be worth the effort.
check out Dokan
https://dokan-dev.github.io/
it's iffy, but it works, and it's free
I don't think you can mount a Linux folder as a network drive under windows having only access to ssh. I can suggest you to use WinSCP that allows you to transfer file through ssh and it's free.
EDIT: well, sorry. Vinko posted before me and now i've learned a new thing :)
Apparently the free NetDrive software from Novell can access SFTP file servers.
Second David's answer below: I needed to mount a network drive automatically when users logged in. Dokan SSHFS is a nice tool, but wasn't reliable enough in this case. The copy of Netdrive I found didn't support SSHFS or sftp - not sure if a more recent one does.
The solution I'm trialling now involves adding a virtual network adapter (with file sharing disabled), using plink to open a tunnel via the new adapter to the remote machine running SAMBA, and mounting the network drive against the new adapter. There's another useful tutorial here http://www.blisstonia.com/eolson/notes/smboverssh.php.
The tunnel and network drive can be set up with a login script, so a few seconds after login users can use the mapped drive without needing to take any action.

Resources