Configuring Bitbucket Server


This section describes the basics of connecting to a server, working with a file, and transmitting data.

Connecting to Server via SSH #

Utilize the ssh tool which is a basic client program from the OpenSSH open-source implementation of the SSH protocol.

The basic command for establishing the connection:

ssh remote_server

  • the remote_server parameter can be an IP address or a domain of your server

If you establish a connection without a username, it assumes that the username on your local machine and remote is the same. If the username differs, then use:

ssh username@remote_server

  • username is an existing user on the server

The scp tool asks passwords or passphrases to verify your identity. For connecting without a password generate public and private keys and configure the sshd daemon program.

For more information, see man ssh from the command line.

Sending File to Server via SSH #

Utilize the scp tool which is a file copy program from the OpenSSH open-source implementation of the SSH protocol.

To copy a file use:

scp file_1 username@remote_server:file_2

  • file_1 - a source file (can be a relative or absolute path)
  • username@remote_server - a username and a remote server address
  • file_2 - a destination file

To copy the whole directory or files from that recursively use:

scp -r /local/directory/ username@remote_server:/remote/directory/

  • /local/directory - a source path (can be a relative or absolute path)
  • /remote/directory - a destination path

For more information, see man scp from the command line.

Working with Script Files #

Create a .sh file for a bash script with the touch tool or vim. To make a file executable use the chmod tool:

chmod +x script.sh

  • +x - a flag, that gives the execute permission,
  • script.sh - a file which we give a permission.

The preceding command gives the execute permission to all existing users.
To specify whom you give a permission add a flag u (for owner), g (for group), o (for others) or a (for all) to the command. For example: chmod u+x script.sh.

If you already have a file, use command ls script.sh to determine the permissions settings of the file. The command produces a message similar to the following:

-rw-r--r-- 1 operator operator 0 Jul 26 17:18 script.sh
[The file without the execute permission.]

-rwxr-xr-x 1 operator operator 0 Jul 26 17:18 script.sh
[The file with the execute permission for owner, users from the same group as owner, other, respectively.]

The first symbol represents a type of a file. Here the - symbol is present and means a regular file.

Other permissions:

r = the read permission,
w = the write permission,
x = the execute permission.