What is the equivalent to "Connect To Server" on the mac for the command line?
I would like to automate the process rather than summon the dialog every time I need to connect to a server.
There are multiple ways to connect to remote server!
I am assuming you have server running on windows OS. Mac OS X includes the SMB protocol for networking with Windows computers; some Linux and Unix systems can also share files with this protocol as well. You can easily mount a shared SMB volume using the mount command. Steps to be followed as below
1) mkdir /temp
2) chmod 777
3) mount -t smbfs //username#ip/nameOfSharefolder /temp
After this you can browse to/temp directory and browse
You can also use sshssh or ftp command to access the remote server but you need to run the ftp server in case of ftp command or remote access must be enable in case of ssh
Related
I currently purchased Synology's ds220+ model and am using it as a NAS Server.
The line is connected to the LAN port of the router to which the WAN line is plugged, and the end is connected to the NAS.
In this situation, I wanted to set up a NAS server to be used externally, not on a local network.
So I even set up WebDAV Server, DDNS, and port forwarding on the router.
To test this, I created a NAS server directory through RaiDrive in a Windows environment.
From the created directory, I tried to upload files to a folder with read/write permission and confirmed that it was working normally.
However, the problem occurred in MacOS.
In Finder, a server folder was created through the "Connect to Server" option, and a file upload was attempted, but an error such as the attached picture occurred in all types of files.
Could you tell me if there is a problem with the way MAC creates the server folder?
Idea: Your OS doesn't support SMB:
Download an FTP or SMB client. (FTP: E.g.: Filezilla)
Idea: A friewall is blocking it:
Check your anti-virus-program
Other Problem:
Use an USB Stick & NAS USB Copy
or upload it via DSM File Manager
Open NAS IP-adress via Safari/Firefox/Chrome
Log In
Open File Station / File Manager
Search folder
Click [Upload]
Choose the file from your PC
Finised
I have a VPN restricted share network on a server (Win 10), and after I connect to VPN and try to connect to that shared network on my Ubuntu 20.04 client (Ubuntu Desktop) via GUI. By GUI, I mean specifically applying these steps:
Open "Files" browser.
Select "+ Other Locations" on the left side-bar menu.
Type your server to connect on "Connect to server", mine was something like smb://myServer/shared/ and click "Connect".
When a login prompt appears, write down your credentials (or login anonymously).
You should have access to that shared network now.
When I did those steps above before upgrading to Ubuntu 20.04, when I was using Ubuntu 18.04, I was able to successfully access to the shared network.
After upgrading to Ubuntu 20.04, however, on the step 4 (after I enter my credentials and try to connect) the connection just hangs, and the shared network is not mounted.
After researching the problem a bit, the potential solutions I found did not work, most of which
suggests to add the following to smb.conf to be able to access to SMB1 type of network.
client min protocol = NT1
server min protocol = NT1
Reference
Can't acces NAS anymore after upgrading to 20.04.
Currently, what I tried aside is to mount the shared folder manually with the following command
sudo mkdir /mnt/my_share
sudo mount -t cifs -o username=name,password=pw //server/shared /mnt/my_share/
which strangely worked.
I do not have a clue why "Files" did not work and manually doing it worked. I cannot say the former failed completely because after entering credentials on login prompt there was no error, but just hangs.
I am mounting a drive on mac os using applescript.
tell application "Finder"
try
mount volume "http://user:pwd#196.145.75.18/mydrive/page.apsx/webdav"
end try
end tell
I am getting drive name as 'webdav' and on the sidebar in shared section I am getting the server address(196.145.75.18) as drive name.
I want to change both of them as 'mydrive'.
Does anyone know how it can be done using applescript? if can not be done using applescript then is there any other way to do this?
What you're doing is the equivalent of using the Finder's "Connect To Server..." command in the Go menu. If you use an IP address there, you're also going to see an IP address in the sidebar. There's no way to change that.
If your target server is on your LAN and has Bonjour/mdns (e.g. OS X, Windows with Bonjour Print Services or iTunes installed, or Linux with avahi-daemon installed), you can instead use "myserver.local" for an address. You can also put "local" as a search domain in your DHCP server (usually your router, but could be OS X Server for example), or manually into your network settings on your client machine(s), to just use "myserver" without ".local".
Or, if your target server is on the WAN, and you have a DNS server for mydomain.com (usually your registrar provides one, or you can host your own with, for example, OS X Server or a router firmware like DD-WRT), you can create a machine (A) record for "myserver.mydomain.com" for that IP address. In your DHCP server (typically your router, but it could be OS X Server), put "mydomain.com" in the DNS search domains; or, if it's a laptop that needs to work in multiple places, put it in manually into the network settings on your client machine(s). Then you don't have to enter the FQDN for an address when you connect, just "myserver".
bash:
mkdir /Volumes/webdav
mount_afp http://user:pwd#196.145.75.18/mydrive/page.apsx/webdav /Volumes/webdav
or more likely:
sudo mkdir /Volumes/webdav
sudo mount_afp http://user:pwd#196.145.75.18/mydrive/page.apsx/webdav /Volumes/webdav
Case 1 in applescript:
do shell script "mkdir /Volumes/webdav"
do shell script "mount_afp http://user:pwd#196.145.75.18/mydrive/page.apsx/webdav /Volumes/webdav"
To use sudo in applescript, you need to create dialog box to type in password etc.
When I try downloading a file from my server onto my computer, it actually downloads the file onto the server.
(Note I am already SSH'd into my server before typing this command. I've watched tutorials on YouTube and people are using their terminal without SSHing into any particular server, however I don't think I can do this with PuTTY on Windows?)
scp -r -P2222 kwazy#mywebsite.example:/home2/kwazy/www/utrecht-connected.nl ~/Desktop/
The problem is that I am specifying the location to download the file as only ~/Desktop/
This creates a folder called Desktop in my server, instead of copying the files onto my local desktop.
I am able to use this command on Linux.
I have successfully download the folder onto my desktop:
I still need insight onto how I can do this on a Windows machine.
There's no way to initiate a file transfer back to/from local Windows from a SSH session opened in PuTTY window.
Though PuTTY supports connection-sharing.
While you still need to run a compatible file transfer client (pscp or psftp), no new login is required, it automatically (if enabled) makes use of an existing PuTTY session.
To enable the sharing see:
Sharing an SSH connection between PuTTY tools.
Even without connection-sharing, you can still use the psftp or pscp from Windows command line.
See How to use PSCP to copy file from Unix machine to Windows machine ...?
Note that the scp is OpenSSH program. It's primarily *nix program, but you can run it via Windows Subsystem for Linux or get a Windows build from Win32-OpenSSH (it is already built-in in the recent versions of Windows 10 and in Windows 11).
If you really want to download the files to a local desktop, you have to specify a target path as %USERPROFILE%\Desktop (what typically resolves to a path like C:\Users\username\Desktop).
Alternative way is to use WinSCP, a GUI SFTP/SCP client. While you browse the remote site, you can anytime open SSH terminal to the same site using Open in PuTTY command.
See Opening Session in PuTTY.
With an additional setup, you can even make PuTTY automatically navigate to the same directory you are browsing with WinSCP.
See Opening PuTTY in the same directory.
(I'm the author of WinSCP)
try this scp -r -P2222 kwazy#mywebsite.example:/home2/kwazy/www/utrecht-connected.nl /Desktop
Another easier option if you're going to be pulling files left and right is to just use an SFTP client like WinSCP. Then you're not typing out 100 characters every time you want to pull something, just drag and drop.
Just noticed /Desktop probably isn't where you're looking to download the file to. Should be something like C:\Users\you\Desktop
OpenSSH has been added to Windows as of autumn 2018, and is included in Windows 10 and Windows Server 2019.
So you can use it in command prompt or power shell like bellow.
C:\Users\Parsa>scp parsa#192.168.100.11:/etc/cassandra/cassandra.yaml F:\Temporary
parsa#192.168.100.11's password:
cassandra.yaml 100% 66KB 71.3KB/s 00:00
C:\Users\Parsa>
(I know this question is pretty old now but this can be helpful for newcomers to this question)
if you install git with git bash, you get SCP available on windows.
You can use WinSCP : https://winscp.net/eng/download.php
Or MobaXterm : https://mobaxterm.mobatek.net/download.html
It feels like FTP client. Also I don't remember setting up anything on my machine for this. It just fresh install and install SSH server (IDK if it matters though).
For MobaXterm :
If your server have a http service you can compress your directory and download the compressed file.
Compress:
tar -zcvf archive-name.tar.gz -C directory-name .
Download throught your browser:
http://the-server-ip/archive-name.tar.gz
If you don't have direct access to the server ip, do a ssh tunnel throught putty, and forward the 80 port in some local port, and you can download the file.
You can use the WinSPC program. Its access to any server is pretty easy. The program gives its guide too. I hope it's helpfull.
If you need something with GUI you can use FileZilla. it support SFTP.
It's perfectly working with ssh and you can even edit files and it will automatically upload the changes.
I am trying to open port 22 on osx so I can connect to localhost using ssh. This is my current situation:
ssh localhost
ssh: connect to host localhost port 22: Connection refused
I have generated a key and tossed it into my authorized_keys file like so:
sh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
A "Network Utility" port scan confirms that 22 (and surprisingly 23) are closed.
Context: I am working on getting Hadoop set up locally. In my configuration, I am running services on localhost:####s and need to open communications to them via ssh.
How can I open 22? or could I be up against another issue (improperly generated key perhaps?)
I think your port is probably open, but you don't have anything that listens on it.
The Apple Mac OS X operating system has SSH installed by default but
the SSH daemon is not enabled. This means you can’t login remotely or
do remote copies until you enable it.
To enable it, go to ‘System Preferences’. Under ‘Internet & Networking’ there is a ‘Sharing’ icon. Run that. In the list
that appears, check the ‘Remote Login’ option. In OS X Yosemite and up, there is no longer an 'Internet & Networking' menu; it was moved to Accounts. The Sharing menu now has its own icon on the main System Preferences menu. (thx #AstroCB)
This starts the SSH daemon immediately and you can remotely login
using your username. The ‘Sharing’ window shows at the bottom the name
and IP address to use. You can also find this out using ‘whoami’ and
‘ifconfig’ from the Terminal application.
These instructions are copied from Enable SSH in Mac OS X, but I wanted to make sure they won't go away and to provide quick access.
I'm using OSX 10.11.6 and this article works for me.
There are 3 solutions available for these.
1) Enable remote login using below command
- sudo systemsetup -setremotelogin on
2) In Mac, go to System Preference -> Sharing -> enable Remote Login
that's it. 100% working solution
3) Final and most important solution is - Check your private area network connection . Sometime remote login isn't allow inside the local area network.
Kindly try to connect your machine using personal network like mobile network, Hotspot etc.
If you try to enable remote login from a terminal window, you may get a "full disk permission issue". Alternatively, You can enable it from Apple Icon -> System Preferences -> Sharing
I am using Mac-bigSur and this is how I enable it on my machine
You can allow access to specific users also.
As per macOS 10.14.5, below are the details:
Go to
system preferences > sharing > remote login.
I couldn't solve the problem; Then I did the following and the issue was resolved:
Refer here:
sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist
(Supply your password when it is requested)
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
ssh -v localhost
sudo launchctl list | grep "sshd"
46427 - com.openssh.sshd