access to client -machine directories while logged-in as ssh - linux

im logged into server by ssh from macOs terminal username_on_server#server_linux:/$ but i couldnt come inside the mac client (while im logging as server user), to change directory or smthing inside client machine to send to server machine
e.g. I need to copy some file or directory from client to server as ssh but any changing directory refers to server
my-mac:~ newuser$ ssh 'username_on_server#server_linux'
username_on_server#server_linux:/home$ pwd
/home

Once you are logged into server_linux you cannot change/modify the client machine, basically the SSH connection is like if you were in the remote server. If you want to copy a file from client to server use instead scp
scp client_file username_on_server#server_linux:/server_path

Related

Login to Linux server with SUDO via Bitwise SSH client

I have been using Bitwise SSH client to transfer files etc on a Linux server.
I now have a new Linux server, and need to change my level of access via SUDO. I'm not sure how to do that with this client.
Is there a config I can use that automatically elevates my access using SUDO?

SSH access parent host folder

After connecting to a remote server (A) through ssh is it possible to access host's folder/files?
This server A has access to another server (B) which I can't access from my computer. I need to run some commands on B using some config files on my computer.
I ended up copying the files from my computer to A using scp and run the commands there.

Using SCP command to download files from Linux server to client server

I'm creating files on a Linux server that I'm logged into and I'm adding the ability for the user to download these files from the Linux server on to the connecting computer. I'm writing a scrip and using the scp command to download these files:
scp data.txt user#usraddress:/home/usr
However, I don't want to specify "user#usraddress:/home/usr" to be just my computer. I want whoever is logged onto the linux server to be able do download these files. Is there a way to get the address of the connecting computer?
How would I do this?
Forgive me if this seems elementary, I'm very new to scripting.
When you open a remote session in a GNU/Linux machine, the ssh server sets the environment variable SSH_CONNECTION with some connection information. You can use this variable and the $USER variable to fill that parameters:
scp data.txt $USER#${SSH_CONNECTION%% *}:/home/$USER
Note that as far as I know you couldn't assume the client home directory is at /home. As said by chepner, you could omit the destination directory to use the default location, the home directory.
scp data.txt $USER#${SSH_CONNECTION%% *}:

FTP From Local Desktop to Server As Sudo User

I have a file on my desktop that I need to FTP to a server. As I've been navigating this server, I need to login with initial credentials to access the box and then needed to run sudo -u [username] ksh to access the folder I need. (No password)
In Filezilla however, I only enter credentials once and therefore, don't have the option to sudo as the user and get permissions to the folder.
Am I going about this process wrong and if so, what's the usual way to do this?
There is no way to switch user on the ftp protocol. You need to know the correct credentials in the first place.
The closest you could come would be to ftp the files to a directory you do have access to, log in with a shell, and then move the files using shell commands after switching user.

Rsync from Linux to Windows SFTP Server

I'm trying to sync documents to an Windows SFTP server via RSYNC on a Linux Machine.
This is my command
rsync -e ssh /home/antony/Documents/Test user1#172.20.1.18:Test
This is the error
exec request failed on channel 0
rsync connection unexpectedly closed (0 bytes recieved so far)[sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.0]
The above may happen for several different reasons.
Maybe the SSH subsystem of rsync is refusing the server key, but this is unlikely because from your description seems like the server is "cutting" the connection, not the client.
Another possibility is that there is no SSH/SFTP server listening on the default port on 172.20.1.18
Or maybe password authentication is not enabled on the server, and you need to authenticate via PKI using a key that you (on the client side) do not have...
In any case, the best thing to do is to double check with the administrator who has configured the server side.

Resources