8

What is the equivalent to "Connect To Server" on the mac for the command line?

Connect to Server

I would like to automate the process rather than summon the dialog every time I need to connect to a server.

EMiller
  • 2,792
  • 4
  • 34
  • 55
Helmut Granda
  • 4,565
  • 7
  • 35
  • 51
  • 1
    `mount_smbfs` with `mkdir` – vadian Jan 04 '17 at 18:06
  • 1
    See [this answer](https://apple.stackexchange.com/a/282778/14586) for how to mount it normally under `/Volumes/` using `osascript` on the command-line. – mivk Jul 19 '18 at 14:13
  • And also [this answer of mine](https://apple.stackexchange.com/a/399035/14586) which details some of the differences between the various methods (`open smb:`, `osascript mount` and `mount`) – mivk Nov 09 '20 at 15:48

1 Answers1

6

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

jelmer
  • 2,405
  • 14
  • 27
  • Meanwhile SMB is the primary protocol on Macs, see [How to connect with File Sharing on your Mac](https://support.apple.com/en-us/HT204445) – vadian Jan 05 '17 at 09:51
  • Why would they call the commnad mount_smbfs however the way you use it is "mount -f smbfs"? That seems confusing. – Helmut Granda Jan 06 '17 at 19:52
  • make sure the mount point `/temp` has appropriate permissions for the user executing the mount command – lobi Feb 19 '20 at 19:45