Creating a local Fedora repository with *Anonymous* rsync - linux

I am trying to setup a local Fedora repository in a local LAN network.
Unfortunately I cannot run rsync in daemon mode because I'm behind a firewall on which I have no control.
Could anyone guide me on how to setup rsync using shell?
I tried the mirrors in http://mirrors.fedoraproject.org/publiclist , I get prompted for passwords. I thought these were supposed to be anonymous access. What am I doing wrong?
Lets say I want to create a local repository for Fedora 13 i386 os, what command would I need to issue on my local system?
Thanks in advance.

The mirrors on the website you linked should all be standard rsync:// mirrors without any passwords
Example:
mkdir os updates
rsync -av rsync://fedora.mirror.netriplex.com/Fedora/releases/13/Everything/i386/os/ os/
rsync -av rsync://fedora.mirror.netriplex.com/Fedora/updates/13/i386/ updates/
If you use cobbler, it will make sure the repositories are up to date for you so long as you cron a "cobbler sync".

Related

How to run SUDO command in WinSCP to transfer files from Windows to linux [duplicate]

This question already has answers here:
WinSCP connect to Amazon AMI EC2 Instance changing user after login to "root"
(6 answers)
Closed last year.
I am trying to use WinSCP to transfer files over to a Linux Instance from Windows.
I'm using private key for my instance to login to Amazon instance using ec2-user. However ec2-user does not have access to write to the Linux instance
How do I sudo su - to access the root directory and write to the Linux box, using WinSCP or any other file transfer method?
Thanks
I know this is old, but it is actually very possible.
Go to your WinSCP profile (Session > Sites > Site Manager)
Click on Edit > Advanced... > Environment > SFTP
Insert sudo su -c /usr/lib/sftp-server in "SFTP Server" (note this path might be different in your system)
Save and connect
Source
AWS Ubuntu 18.04:
There is an option in WinSCP that does exactly what you are looking for:
AFAIK you can't do that.
What I did at my place of work, is transfer the files to your home (~) folder (or really any folder that you have full permissions in, i.e chmod 777 or variants) via WinSCP, and then SSH to to your linux machine and sudo from there to your destination folder.
Another solution would be to change permissions of the directories you are planning on uploading the files to, so your user (which is without sudo privileges) could write to those dirs.
I would also read about WinSCP Remote Commands for further detail.
Usually all users will have write access to /tmp.
Place the file to /tmp and then login to putty , then you can sudo and copy the file.
I just wanted to mention for SUSE Enterprise server V15.2 on an EC2 Instance the command to add to winSCP SFTP server commands is :
sudo su -c /usr/lib/ssh/sftp-server
I didn't have enough Reputation points to add a comment to the original answer but I had to fish this out so I wanted to add it.
ssh to FreePBX and run the commands stated below in your terminal:
sudo nano -f /etc/sudoers.d/my_config_file
YourUserName ALL=(ALL) NOPASSWD:ALL
sudo systemctl restart sshd
Winscp:
under session login ==> Advanced ==> SFTP
Change SFTP Server to:
sudo /usr/libexec/openssh/sftp-server
I do have the same issue, and I am not sure whether it is possible or not,
tried the above solutions are not worked for me.
for a workaround, I am going with moving the files to my HOME directory, editing and replacing the files with SSH.
Tagging this answer which helped me, might not answer the actual question
If you are using password instead of private key, please refer to this answer for tested working solution on Ubuntu 16.04.5 and 20.04.1
https://stackoverflow.com/a/65466397/2457076

how to transfer a home-dir structure from one linux PC to another linux PC

How can I transfer via tar the whole /home/.. tree with all the file attributes from one linux to another linux PC? I know I could write it to a tar file but I have not so much space on the target. Is there a way to pipe it with the tar command?
I would use rsync and ssh
Set up ssh
You need to install openssh-client on the receiving computer and openssh-server on the sending computer. Use the help distribution specific help docs for help setting this up.
rsync files
Go onto the 2nd computer and rsync the folder from the other first pc.
rsync -av ipofpc1:/home/ /home/
There are a variety of ways, but in this case I'd recommend using rsync.
First you need to install a SSH server on the target computer if you don't alrady have one running. For example on Debian/Ubuntu/Mint you'd do apt-get install openssh-server.
Then install rsync on the computer with the source folder. For example : apt-get install rsync.
And finally you can use rsync like this:
rsync --razh user#YOUR_OTHER_COMPUTER:/destination/path /home/

Export SVN repository over FTP to a remote server

I'm using following command to export my repository to a local path:
svn export --force svn://localhost/repo_name /share/Web/projects/project_name
Is there any, quite easy (Linux newbie here) way to do the same over FTP protocol, to export repository to a remote server?
Last parameter of svn export AFAIK have to be a local path and AFAIK this command does not support giving paths in form of URLs, like for example:
ftp://user:pass#server:path/
So, I thing there should be some script hired here to do the job.
I have asked some people about that, and was advised that the easiest way is to export repository to a local path, transfer it to an FTP server and then purge local path. Unfortunately I failed after first step (extract to local path! :) So, the support question is, if it can be done on-the-fly, or really have to be split into two steps: export + ftp transfer?
Someone also advised me to setup local SVN client on remote server and do simple checkout / update from my repository. But this is solution possible only if everything else fails. As I want to extract pure repository structure, without SVN files, which I would get, when go this way.
BTW: I'm using QNAP TS-210, a simple NAS device, with very limited Linux on board. So, many command-line commands as good as GUI are not available to me.
EDIT: This is second question in my "chain". Even, if you help me to succeed here, I won't be able to automate this job (as I'm willing to) without your help in question "SVN: Force svn daemon to run under different user". Can someone also take a look there, please? Thank you!
Well, if you're using Linux, you should be able to mount an ftpfs. I believe there was a module in the Linux kernel for this. Then I think you would also need FUSE.
Basically, if you can mount an ftpfs, you can write your svn export directly to the mounted folder.
not sure about FTP, but SSH would be a lot easier, and should have better compression. An example of sending your repo over SSH may look like:
svnadmin dump /path/to/repository |ssh -C username#servername 'svnadmin -q load /path/to/repository/on/server'
URL i found that info was on Martin Ankerl's site
[update]
based on the comment from #trejder on the question, to do an export over ssh, my recomendation would be as follows:
svn export to a folder locally, then use the following command:
cd && tar czv src | ssh example.com 'tar xz'
where src is the folder you exported to, and example.com is the server.
this will take the files in the source folder, tar and gzip them and send them over ssh, then on ssh, extract the files directly to the machine....
I wrote this a while back - maybe it would be of some use here: exup

git for use on local machine only, with no cloning to/from remote machines?

On a CentOS Linux machine, developers have user accounts. They need to be able to use git on the local machine while logged in via ssh, but is there a way to prevent them from cloning their repositories to other machines?
No. If a user can ssh to a machine and they have read permissions on a repository, they can copy the repository (using rsync or scp), and that is all that is necessary to clone a git repository.
Technically, no. You could probably remove git-upload-pack from the system which would make this harder by making git clone stop working, but a simple scp of the entire directory would still be sufficient.
ensure other machines are not writable / accessible, but other than that no.

linux (red hat) compare directories and copy over files that are different

I basically want rsync, but don't have the luxury of being able to install it.
But I need a way to deploy files from one server to another. I edit one or more files on one server and then need to copy all modified files to another server by comparing files that aren't the same (and being able to exclude .htaccess files)
Does anyone know of an easy way to do this?
Thanks,
Scott
(I will assume that you have shell access to both servers)
You do not need to install rsync system-wide. You can install it in your home-directory. First get a copy of the rsync binary for your distribution:
You can extract it from the rsync RPM package using rpm2cpio and cpio
You can copy it from another RedHat installation
You can copy it from another Linux installation for the same platform - there is a string possibility that it will work fine
Then you need to permanently modify the PATH environment variable so that the rsync command is found by your shell. If you do that for your user accounts in both servers, you can use rsync normally without the need for root privileges.
If you have access to install rsync on one server, that's all you need minimum.
If not, the question is what tools do you currently have available? scp? sftp? ftp? ssh? telnet? find?

Resources