Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the acf domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6131

Deprecated: Creation of dynamic property ACF::$fields is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields.php on line 138

Deprecated: Creation of dynamic property acf_loop::$loops is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/loop.php on line 28

Deprecated: Creation of dynamic property ACF::$loop is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/loop.php on line 269

Deprecated: Creation of dynamic property ACF::$revisions is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/revisions.php on line 397

Deprecated: Creation of dynamic property acf_validation::$errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php on line 28

Deprecated: Creation of dynamic property ACF::$validation is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php on line 214

Deprecated: Creation of dynamic property acf_form_customizer::$preview_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 28

Deprecated: Creation of dynamic property acf_form_customizer::$preview_fields is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 29

Deprecated: Creation of dynamic property acf_form_customizer::$preview_errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 30

Deprecated: Creation of dynamic property ACF::$form_front is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php on line 598

Deprecated: Creation of dynamic property acf_form_widget::$preview_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 34

Deprecated: Creation of dynamic property acf_form_widget::$preview_reference is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 35

Deprecated: Creation of dynamic property acf_form_widget::$preview_errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 36

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the all-in-one-wp-migration domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6131

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp_plugin/wp_plugin.php on line 23

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 54

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 1539

Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 828

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rocket domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6131

Deprecated: Creation of dynamic property acf_field_oembed::$width is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php on line 31

Deprecated: Creation of dynamic property acf_field_oembed::$height is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php on line 32

Deprecated: Creation of dynamic property acf_field_google_map::$default_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-google-map.php on line 33

Deprecated: Creation of dynamic property acf_field__group::$have_rows is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-group.php on line 31

Deprecated: Creation of dynamic property acf_field_clone::$cloning is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-clone.php on line 34

Deprecated: Creation of dynamic property acf_field_clone::$have_rows is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-clone.php on line 35

Deprecated: Creation of dynamic property jh_acf_field_table::$settings is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-table-field/class-jh-acf-field-table.php on line 23

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902
{"id":24924,"date":"2021-09-30T09:31:57","date_gmt":"2021-09-30T06:31:57","guid":{"rendered":"https:\/\/upcloud.com\/community\/tutorials\/transfer-files-linux-samba"},"modified":"2021-09-30T09:31:57","modified_gmt":"2021-09-30T06:31:57","slug":"transfer-files-linux-samba","status":"publish","type":"tutorial","link":"https:\/\/studiogo.tech\/upcloudold\/tutorial\/transfer-files-linux-samba\/","title":{"rendered":"How to transfer files to Linux server using Samba"},"content":{"rendered":"\n

Once you have your first Linux server up and running, you might be wondering how to transfer files or folders between your server and your local computer. Luckily, there\u2019s an easy solution by setting up a Samba file service on your Cloud Server.<\/p>\n\n\n\n

Samba is a suite of Unix applications that speak the Server Message Block (SMB) protocol. Microsoft Windows operating systems and the OS\/2 operating system use SMB to perform client-server networking for file and printer sharing and associated operations.<\/p>\n\n\n\n

In short, Samba helps you transfer files between your server and your local computer. In this tutorial, we\u2019ll show the steps to set up and configure your Cloud Server with Samba.<\/p>\n\n\n\n

Setting up your server<\/h2>\n\n\n\n

To begin, you need a Linux-based Cloud Server, this can be Ubuntu, Debian or Centos. You can find out more in our tutorial on how to create a new Cloud Server<\/a>.<\/p>\n\n\n\n

When your server is live, log in using SSH<\/a> and continue by updating the server software.<\/p>\n\n\n\n

sudo apt update && sudo apt upgrade<\/code><\/p>\n\n\n\n

Then install Samba with the following command.<\/p>\n\n\n\n

sudo apt install samba<\/code><\/p>\n\n\n\n

We can check if the installation was successful by looking up the installation location.<\/p>\n\n\n\n

whereis samba<\/code><\/p>\n\n\n\n

You should see an output similar to the example below.
samba: \/usr\/sbin\/samba \/usr\/lib\/samba \/etc\/samba \/usr\/share\/samba \/usr\/share\/man\/man7\/samba.7.gz \/usr\/share\/man\/man8\/samba.8.gz<\/code><\/p>\n\n\n\n

With Samba installed, we will next configure the firewall.<\/p>\n\n\n\n

Depending on your Linux distribution, you will have either ufw or firewalld. If you are running Ubuntu or Debian, UFW is the firewall of choice. CentOS on the other hand comes with firewalld.<\/p>\n\n\n\n

sudo ufw allow 'Samba' <\/code><\/p>\n\n\n\n

You should also allow SSH to prevent yourself from getting locked out.<\/p>\n\n\n\n

sudo ufw allow ssh<\/code><\/p>\n\n\n\n

Next, enable the firewall and the configured rules.<\/p>\n\n\n\n

sudo ufw enable <\/code><\/p>\n\n\n\n

Now let\u2019s verify that the firewall is enabled as well as that Samba and SSH are allowed.<\/p>\n\n\n\n

sudo ufw status verbose <\/code><\/p>\n\n\n\n

The output should show something like the example below.<\/p>\n\n\n\n

Status: active
\nLogging: on (low)
\nDefault: deny (incoming), allow (outgoing), disabled (routed)
\nNew profiles: skip
\nTo Action From
\n-- ------ ----
\n137,138\/udp (Samba) ALLOW IN Anywhere
\n139,445\/tcp (Samba) ALLOW IN Anywhere
\n22\/tcp ALLOW IN Anywhere
\n137,138\/udp (Samba (v6)) ALLOW IN Anywhere (v6)
\n139,445\/tcp (Samba (v6)) ALLOW IN Anywhere (v6)
\n22\/tcp (v6) ALLOW IN Anywhere (v6)
\n<\/code><\/p>\n\n\n\n

Verifying the default configuration<\/h2>\n\n\n\n

Now let\u2019s start configuring Samba. However, before you start, you should always make a backup of the configuration file. This way you always have a way to restore the default settings if something goes wrong.<\/p>\n\n\n\n

sudo cp \/etc\/samba\/smb.conf{,.backup}<\/code><\/p>\n\n\n\n

Open the Samba configuration file with a text editor, for example, using nano with the following command.<\/p>\n\n\n\n

sudo nano \/etc\/samba\/smb.conf <\/code><\/p>\n\n\n\n

Then find the server role setting in the configuration file. The default value should be set to \u201cstandalone server\u201d.<\/p>\n\n\n\n

...
\n# Most people will want \"standalone sever\" or \"member server\".
\n# Running as \"active directory domain controller\" will require first
\n# running \"samba-tool domain provision\" to wipe databases and create a
\n# new domain.
\nserver role = standalone server
\n...<\/code><\/p>\n\n\n\n

Now let\u2019s test our configuration file with the command below.<\/p>\n\n\n\n

testparm<\/code><\/p>\n\n\n\n

Load smb config files from \/etc\/samba\/smb.conf
\nLoaded services file OK.
\nServer role: ROLE_STANDALONE<\/code><\/p>\n\n\n\n

If there are no errors, your output should show the configuration as well as say \u201cLoaded services file ok\u201d like the example above.<\/p>\n\n\n\n

Let\u2019s restart the related services to make sure everything is running.
sudo systemctl restart smbd
\nsudo systemctl restart nmbd<\/code><\/p>\n\n\n\n

Setting up Samba<\/h2>\n\n\n\n

Now that Samba is installed, we need to create a directory for it to share, this makes it more organised.<\/p>\n\n\n\n

mkdir \/samba<\/code><\/p>\n\n\n\n

The command above creates a new folder called samba in the system root which we will share later.<\/p>\n\n\n\n

Now let\u2019s set the group ownership of the shared directory to the sambashare group which was created during the Samba installation.<\/p>\n\n\n\n

sudo chgrp sambashare \/samba<\/code><\/p>\n\n\n\n

Setting up a user account<\/h2>\n\n\n\n

Samba utilises both Linux users and group permission as well as its own mechanism.<\/p>\n\n\n\n

Let\u2019s create a user account using the useradd<\/tt> command. You can replace the example username upcloud with what you prefer.<\/p>\n\n\n\n

sudo useradd -M -d \/samba\/upcloud<\/span> -s \/usr\/sbin\/nologin -G sambashare upcloud<\/span><\/code><\/p>\n\n\n\n

Breaking down the above command you just entered.<\/p>\n\n\n\n