One place for hosting & domains


      How to Fix the 500 Internal Server Error in WordPress (10 Tips)

      Seeing a 500 internal server error where your website should be is enough to throw anyone into a panic. When your website goes down, you lose out on potential traffic and sales. If it’s offline for a while, it can also negatively impact your Search Engine Optimization (SEO) efforts.

      Fortunately, there are plenty of ways to go about fixing this error. Many of these solutions are fairly straightforward, and you don’t need a lot of technical know-how to start troubleshooting.

      In this guide, we’ll cover what the 500 internal server error in WordPress is and discuss some potential causes. Then we’ll give you 10 tips to help you get your website back in working order.

      1. Back up your website.
      2. Try reloading the page.
      3. Clear your browser cache.
      4. Access your error logs.
      5. Check for the “Error Establishing a Database Connection.”
      6. Look for permission errors.
      7. Increase your PHP memory limit.
      8. Check for problems with your .htaccess file.
      9. Look for coding or syntax errors in your CGI/Perl script.
      10. Ask your web host about potential server issues.

      Let’s get started!

      Dealing with the WordPress Internal Server Error?

      Avoid troubleshooting when you sign up for DreamPress. Our friendly WordPress experts are available 24/7 to help solve website problems — big or small.

      What Is the 500 Internal Server Error?

      The 500 internal server error is frustratingly nonspecific. When the error occurs, you usually don’t get many details about it. In fact, you might not receive any information at all.

      An example of a 500 internal server error screen.

      The 500 error is a generic issue that isn’t specific to WordPress. Chances are you’ve seen it before during your internet explorations. Despite the name, it doesn’t necessarily mean that something is wrong with your server. It could be an issue with your website or browser.

      If you do see this error on your site, you’ll want to get it fixed as quickly as possible. A 500 error can impact your SEO if allowed to linger. If your site is crawled while it’s offline, there’s a chance that Google may interpret the error as an issue with your website.

      This error can also hurt your User Experience (UX) and give visitors the impression that you’re unprofessional. Not only can a poor UX affect the way Google ranks your site, but it can cause you to lose customers as well. After all, you can’t do business if your site isn’t accessible.

      A wide variety of situations can result in the 500 error, making it a bit of a chore to sort out. Potential causes of the 500 internal server error in WordPress include:

      • Plugin compatibility issues
      • Exhausted PHP memory limit
      • Corrupted files
      • Coding or syntax errors

      The fact that the error message itself tends to be vague doesn’t help. Fortunately, you can solve many of these issues on your own with a bit of know-how.

      Variations on the 500 Internal Server Error

      Depending on your operating system, browser, and the cause of the error, there are variations in how it will appear. For example, if a database connection can’t be established, you might see something like this:

      An error establishing a database connection message.

      A plain white screen, sometimes referred to as the White Screen of Death (WSoD), can indicate a 500 internal server error.

      A blank browser window due to a 500 error.

      Also, many site owners have the option to customize their 500 error messages. So you might see this error in many different forms.

      How to Fix the 500 Internal Server Error in WordPress (10 Tips)

      Now that you’ve had an introduction to the 500 internal server error, it’s time to discuss how to resolve it. Let’s take a look at ten tips you can use to fix this issue in WordPress.

      1. Back up your website.

      Before tinkering under the hood, it’s always smart to make a backup of your website. If DreamHost hosts your site, you can take advantage of our one-click backup feature. You can also create a manual backup if you prefer.

      To make a complete backup, you’ll need to save copies of your WordPress files as well as your databases. You can back up your site’s files using a Secure File Transfer Protocol (SFTP) client such as FileZilla.

      Once you’re connected to your server, navigate to the WordPress files you want to save. These files include the WordPress core installation, plugins, themes, images, and more. To save the files, simply right-click on them and select Download.

      How to download WordPress files via SFTP.

      Now you’ll need to back up your database, which you can do by logging into phpMyAdmin. Select the database you want to download from the left-hand panel, and then click on the Export tab.

      You’ll then need to choose between a “Quick” or a “Custom” export. The Quick export will likely work just fine unless you need to manage more advanced options.

      Options for downloading a WordPress database using phpMyAdmin.

      Click on the Go button, and your download should start. Once your website is safely backed up, you can get to work on fixing that 500 error.

      2. Try reloading the page.

      Let’s start with the best-case scenario. Some situations that cause a 500 internal error clear up on their own within a few minutes. For example, if you’ve just made changes to a plugin or theme, or if your host is experiencing unusually heavy traffic, you may see a server error. If this is true in your case, you’re in luck, as a simple page reload should get things back to normal.

      Therefore, the first thing to try is simply waiting a minute or two, during which the error will hopefully resolve itself. Then you can try reloading the page by pressing F5 or (command + R if you’re using a Mac).

      3. Clear your browser cache.

      Another potential server error fix that’s quick and easy is clearing your browser cache. It’s possible the cache became corrupted, which would cause problems when attempting to access websites.

      First, you might check Down For Everyone Or Just Me. This will determine whether there’s a widespread problem or you’re the only one experiencing difficulties.’s status on Down for Everyone or Just Me.

      If you’re alone in your 500 error frustration, the problem may be your browser. Try accessing your site from a different browser. If an alternative works, it’s a sign that the issue is with your cache.

      In Google Chrome, you can clear your cache by pressing Ctrl + Shift + Delete. Alternatively, you can click on the three vertical dots in the top-right corner, followed by More tools > Clear browsing data.

      Options for clearing the browser cache in Chrome.

      Be sure to check the Cached images and files box. Then click on the Clear data button.

      In Firefox, you can clear the cache using the Ctrl + Shift + Delete keyboard shortcut. This will open the Clear Recent History window. In the Time range to clear drop-down menu, select Everything. Check the Cache box, and then click on OK.

      Options for clearing browser data in Firefox.

      In Safari, you can navigate to the History menu item and choose Clear History. Keep in mind that this will delete everything, including cookies and visited pages.

      How to clear the browser cache in Safari.

      Once you’ve cleared your browser cache, you can attempt to access your website again. If you’re still seeing the 500 internal server error, it’s time to move on to more involved fixes.

      4. Access your error logs.

      Your site’s error logs may provide insight into what’s causing the 500 error. Depending on your host, these logs may be cycled quite often, so you’ll want to take a look as soon as possible.

      You can check your error logs by accessing your site’s files via SFTP and looking for the /logs directory. Next, select the site that’s experiencing the error. You may see several directories at this point. You’ll want to check the one with the most recent date.

      Error and access log files accessed via FileZilla.

      You can view the log by downloading it and opening it with your preferred text editor. Hopefully, your error logs will provide you with some additional context for the 500 error.

      Another option is to enable the WordPress debug log. You can do this by connecting to your site via SFTP and opening your wp-config.php file. Within it, look for the following line:

      define('WP_DEBUG', false);

      Once you find it, replace it with the following:

      define( 'WP_DEBUG', true );
      define( 'WP_DEBUG_DISPLAY', false );
      define( 'WP_DEBUG_LOG', true );

      This will create a debug.log file, which you can find under the /wp-content/ directory. Just be sure to change the WP_DEBUG value back to “false” when you’re done troubleshooting.

      5. Check for the ‘Error Establishing a Database Connection.’

      If there’s been a problem establishing a database connection, not only will your site be offline for visitors, but you won’t be able to access the WordPress admin dashboard either. There are a few possible causes of this:

      • Incorrect database login credentials
      • A corrupted WordPress database
      • A corrupted WordPress installation file

      Let’s start with incorrect login credentials, as this is a common cause of the database connection error. If you’re a DreamHost user, you can find your database credentials in your panel. However, if you use a different host, you’ll likely follow a similar procedure.

      Navigate to MySQL Databases and find the one that corresponds to your website under the Database(s) on this server section. Here, you’ll find your database name under the Database heading. The username is listed under the Users Access column.

      Alt-text: Where to find your MySQL username in DreamPanel.

      To find the password, click on the username. On the next screen, scroll down and click on the Show button next to the password field.

      How to find your database password in DreamPanel.

      Next, you’ll compare these credentials to those in your wp-config.php file. You can access this file in your site’s main directory via SFTP. Once you have the file downloaded, open it and verify that the information under MySQL Settings matches what you found in your panel.

      Checking MySQL settings in the wpconfig.php file.

      Next, if your database is corrupted, you can quickly repair it through phpMyAdmin. Log in and click on your database in the left panel. Select all of the tables in the database, and then choose the Repair table option from the drop-down menu.

      Repairing a database in phpMyAdmin.

      Finally, let’s look at how to handle a corrupted WordPress installation file. Start by downloading a new copy of WordPress and unzipping the file. You’ll need to delete the wp-content folder and the wp-config-sample.php file.

      Deleting files from a new WordPress installation.

      Upload the rest of the files to your site via SFTP, overwriting any existing ones. You now have a brand new, uncorrupted WordPress installation. You’ll also want to clear your browser cache before checking your website again.

      6. Look for permission errors.

      If any of your files have permissions set incorrectly, you may see the 500 internal server error as a result. Again, you can check and change these permissions using SFTP.

      Right-click on any file and select File permissions to open a new dialogue window. In this window, you can check and, if necessary, set new permissions for the file.

      Checking and updating file permissions using FileZilla.

      Typically, you’ll want to set files to “644” and directories and executables to “755”. However, you may want to check with your host if you’re unsure about the correct values.

      7. Increase your PHP memory limit.

      Another reason you might see the 500 internal server error is if you’ve exceeded your server’s PHP memory limit. There are several ways to increase your limit, and they all involve using SFTP.

      Before you try increasing your memory limit, you may want to start by seeing what it’s currently set to. You can do this through the WordPress admin dashboard. Keep in mind that, with some variations of the 500 error, you won’t be able to access the dashboard. If that’s the case, you may have to skip this step.

      From your WordPress dashboard, navigate to Tools > Site Health. Click on Info at the top of the screen, and scroll down to the Server section. You should see your PHP memory limit there.

      How to check your WordPress site’s PHP memory limit.

      To increase the PHP memory limit, there are a few files you can edit. One is your .htaccess file, typically located in your site’s root directory. Open the file and add the following code:

      php_value memory_limit xxxM

      You can replace the “xxx” with your desired amount of memory. Usually, 256M is plenty.

      You can also increase your memory limit by editing your php.ini file. You should be able to find this file in your root directory. If not, you can go ahead and create one. Add or update its code to the following:

      memory_limit = xxxM

      Another option is to add in the following code at the top of your wp-config.php file:

      define('WP_MEMORY_LIMIT', 'xxxM');

      If this resolves the 500 error, your next task will be to figure out what is causing the memory limit exhaustion. It could be a problematic plugin or theme. You might consider reaching out to your host for help on finding the exact server diagnostics.

      8. Check for problems with your .htaccess file.

      Your .htaccess file is one of the core WordPress files. It contains rules for your server, so it could contribute to a 500 internal server error.

      If your .htaccess file has become corrupted, you’ll want to go ahead and create a fresh one. Start by logging into your site via SFTP and finding your .htaccess file. Rename the file to .htaccess_old.

      Renaming a file in FileZilla.

      Now, create a new .htaccess file in your text editor and paste in the following:

      # BEGIN WordPress
      RewriteEngine On
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
      RewriteBase /
      RewriteRule ^index.php$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
      # END WordPress

      Go ahead and upload your newly created .htaccess file. Then refresh your site in your browser, and check to see whether the error message is showing.

      9. Look for coding or syntax errors in your CGI/Perl script.

      If you’re running Common Gateway Interface (CGI) scripts, any coding errors you’ve made could result in a 500 error. To unearth potential issues with your CGI scripts, log into your site using Secure Shell Access (SSH).

      Once you’ve logged in, you can troubleshoot your CGI with this command:

      [server]$ ./cgi_name.cgi

      The terminal should return a general error message and the line number the culprit is located on. From there, you can work your coding magic!

      When working with CGI, there are a few best practices to keep in mind to avoid problems. First, it’s wise to use a plain text editor to ensure that you maintain ASCII format. When you upload scripts, you should also be able to select ASCII mode in your FTP client.

      Changing the transfer type option in FileZilla.

      Finally, if necessary, upload to the cgi-bin directory on your server. Then you can double-check your files’ permissions once you have them uploaded.

      10. Ask your web host about potential server issues.

      If all else fails, there may be a server issue, which only your host can confirm. Unfortunately, if your host’s server is experiencing a problem, you may have to wait out some website downtime.

      If you’re a DreamHost client, you can check the DreamHost Status page. This resource provides you with information on all of our services.

      The DreamHost status page.

      If you run into any problems while trying to repair the 500 internal server error, you can always reach out to our tech support team. They’re ready and waiting to lend you a hand! If you’ve followed the tips in this guide, you’ll have plenty of valuable information for the technician.

      Ready to Dive into Your Error Log?

      Whether you need help with file permission, identifying a hidden file, or dealing with a faulty plugin, we can help! Subscribe to our monthly digest so you never miss an article.

      Let’s Get Your WordPress Website Back on Track

      While having to sort out a 500 internal server error isn’t exactly fun, it’s also not as painful as you might imagine. With a little patience and the tips we’ve provided, you should be able to make some progress on getting your website back online.

      You can start small by refreshing your page and clearing your browser cache. Then you might want to move onto more involved fixes, such as increasing your PHP memory limit. If you’re not able to resolve the error on your own, DreamHost’s award-winning tech support is just a click away.

      When you do run into errors, it’s easier to get back up and running when you have a reliable hosting provider. DreamPress is fast, secure WordPress hosting with powerful features to help make your site a success!

      Source link

      Cara Menggunakan SFTP untuk Mentransfer Berkas secara Aman dengan Server Jauh


      FTP, atau “File Transfer Protocol” adalah metode tidak terenkripsi yang populer untuk mentransfer berkas di antara dua sistem jauh.

      SFTP, yang merupakan singkatan SSH File Transfer Protocol, atau Secure File Transfer Protocol, adalah protokol terpisah yang dipaketkan dengan SSH yang bekerja dalam cara serupa tetapi melalui koneksi aman. Keuntungannya adalah kemampuan memanfaatkan koneksi aman untuk mentransfer berkas dan melintasi sistem berkas di sistem jauh dan lokal.

      Umumnya, SFTP lebih disukai daripada FTP karena fitur keamanan yang mendasari dan kemampuannya melakukan piggyback pada koneksi SSH. FTP adalah protokol tidak aman yang seharusnya hanya digunakan dalam kasus terbatas atau pada jaringan yang Anda percayai.

      Meskipun SFTP terintegrasi ke dalam banyak alat grafis, panduan ini akan memperagakan cara menggunakannya melalui antarmuka baris perintah interaktifnya.

      Cara Menghubungkan dengan SFTP

      Secara asali, SFTP menggunakan protokol SSH untuk mengautentikasi dan membuat koneksi aman. Karena ini, metode autentikasi yang sama tersedia di SSH.

      Meskipun kata sandi mudah digunakan dan disiapkan secara asali, kami menyarankan Anda membuat kunci SSH dan mentransfer kunci publik ke sistem yang perlu Anda akses. Ini jauh lebih aman dan dapat menghemat waktu dalam jangka panjang.

      Lihatlah panduan ini untuk menyiapkan kunci SSH guna mengakses server jika Anda belum melakukannya.

      Jika dapat menghubungkan ke mesin menggunakan SSH, berarti Anda telah menyelesaikan semua persyaratan menggunakan SFTP untuk mengelola berkas. Uji akses SSH dengan perintah berikut:

      • ssh sammy@your_server_ip_or_remote_hostname

      Jika berhasil, keluar kembali dengan mengetikkan:

      Sekarang kita dapat membuat sesi SFTP dengan mengeluarkan perintah berikut:

      • sftp sammy@your_server_ip_or_remote_hostname

      Anda akan menghubungkan sistem jauh dan prompt Anda akan berubah menjadi prompt SFTP.

      Jika Anda bekerja di porta SSH khusus (bukan porta asali 22), maka Anda dapat membuka sesi SFTP seperti berikut:

      • sftp -oPort=custom_port sammy@your_server_ip_or_remote_hostname

      Ini akan menghubungkan Anda ke sistem jauh melalui porta yang ditentukan.

      Mendapatkan Bantuan di SFTP

      Perintah paling berguna untuk dipelajari terlebih dahulu adalah perintah help. Perintah ini memberi Anda akses ke ringkasan bantuan SFTP. Anda dapat memanggilnya dengan mengetikkan salah satu dari ini di prompt:


      Ini akan menampilkan daftar perintah yang tersedia:


      Available commands: bye Quit sftp cd path Change remote directory to 'path' chgrp grp path Change group of file 'path' to 'grp' chmod mode path Change permissions of file 'path' to 'mode' chown own path Change owner of file 'path' to 'own' df [-hi] [path] Display statistics for current directory or filesystem containing 'path' exit Quit sftp get [-Ppr] remote [local] Download file help Display this help text lcd path Change local directory to 'path' . . .

      Kita akan mendalami beberapa perintah yang Anda lihat di bagian berikut.

      Menavigasi dengan SFTP

      Kita dapat menavigasi hierarki berkas sistem jauh menggunakan sejumlah perintah yang berfungsi mirip dengan padanan shell-nya.

      Pertama-tama, mari kita ketahui di direktori mana kita saat ini pada sistem jauh. Sama seperti dalam sesi shell pada umumnya, kita dapat mengetikkan yang berikut untuk mendapatkan direktori saat ini:


      Remote working directory: /home/demouser

      Kita dapat melihat isi direktori saat ini di sistem jauh dengan perintah lainnya yang sudah familier:


      Summary.txt info.html temp.txt testDirectory

      Perhatikan bahwa perintah dalam antar muka SFTP bukanlah perintah shell biasa dan tidak kaya fitur, tetapi perintah-perintah itu mengimplementasikan beberapa bendera opsional yang lebih penting:


      drwxr-xr-x 5 demouser demouser 4096 Aug 13 15:11 . drwxr-xr-x 3 root root 4096 Aug 13 15:02 .. -rw------- 1 demouser demouser 5 Aug 13 15:04 .bash_history -rw-r--r-- 1 demouser demouser 220 Aug 13 15:02 .bash_logout -rw-r--r-- 1 demouser demouser 3486 Aug 13 15:02 .bashrc drwx------ 2 demouser demouser 4096 Aug 13 15:04 .cache -rw-r--r-- 1 demouser demouser 675 Aug 13 15:02 .profile . . .

      Untuk mendapatkan direktori lainnya, kita dapat mengeluarkan perintah ini:

      Sekarang kita dapat melintasi sistem berkas jauh, tetapi bagaimana jika kita perlu mengakses sistem berkas lokal kita? Kita dapat mengarahkan perintah ke sistem berkas lokal dengan menambahkan l di awal untuk lokal.

      Semua perintah yang dibahas sejauh ini memiliki padanan lokal. Kita dapat mencetak direktori kerja lokal:


      Local working directory: /Users/demouser

      Kita dapat membuat daftar isi direktori saat ini pada mesin lokal:


      Desktop local.txt test.html Documents analysis.rtf zebra.html

      Kita juga dapat mengubah direktori yang ingin kita tangani di sistem lokal:

      Mentransfer Berkas dengan SFTP

      Menyusuri sistem berkas jauh dan lokal terbatas kegunaannya bila tidak dapat mentransfer berkas di antara kedua sistem.

      Mentransfer Berkas Jauh ke Sistem Lokal

      Jika ingin mengunduh berkas dari hos jauh, kita dapat melakukannya dengan mengeluarkan perintah berikut:


      Fetching /home/demouser/remoteFile to remoteFile /home/demouser/remoteFile 100% 37KB 36.8KB/s 00:01

      Seperti yang Anda lihat, secara asali, perintah get mengunduh berkas jauh ke berkas dengan nama yang sama di sistem berkas lokal.

      Kita dapat menyalin berkas jauh ke nama yang berbeda dengan menentukan namanya kemudian:

      Perintah get juga menggunakan beberapa bendera opsi. Misalnya, kita dapat menyalin direktori dan semua isinya dengan menentukan opsi rekursif:

      Kita dapat memberi tahu SFTP untuk mempertahankan izin dan waktu akses yang sesuai menggunakan bendera -P atau -p:

      Mentransfer Berkas Lokal ke Sistem Jauh

      Mentransfer berkas ke sistem jauh mudah dilakukan menggunakan perintah “put” dengan semestinya:


      Uploading localFile to /home/demouser/localFile localFile 100% 7607 7.4KB/s 00:00

      Bendera yang sama yang dapat digunakan pada get juga dapat digunakan pada put. Jadi, untuk menyalin seluruh direktori lokal, Anda dapat mengeluarkan:

      Catatan: Saat ini ada kutu di versi OpenSSH yang disertakan pada rilis Ubuntu saat ini (setidaknya 14.04 hingga 15.10) yang menghalangi pengoperasian perintah di atas dengan benar. Setelah mengeluarkan perintah di atas untuk mentransfer konten ke server menggunakan versi OpenSSH yang mengandung kutu, pesan kesalahan berikut akan diberikan: Couldn't canonicalise: No such file or directory.

      Untuk mengatasi masalah ini, buat direktori tujuan di sistem jauh terlebih dahulu dengan mengetikkan mkdir localDirectory. Setelah itu, perintah di atas akan dijalankan tanpa kesalahan.

      Satu alat yang telah dikenal yang berguna saat mengunduh dan mengunggah berkas adalah perintah df, yang fungsinya mirip dengan versinya di baris perintah. Dengan alat ini, Anda dapat memeriksa apakah cukup ruang untuk menyelesaikan transfer yang Anda inginkan:


      Size Used Avail (root) %Capacity 19.9GB 1016MB 17.9GB 18.9GB 4%

      Perhatikan, tidak ada variasi lokal perintah ini, tetapi kita dapat mengatasinya dengan mengeluarkan perintah !.

      Perintah ! menempatkan kita ke dalam shell lokal sehingga kita dapat menjalankan perintah apa pun yang tersedia di sistem lokal kita. Kita dapat memeriksa penggunaan diska dengan mengetikkan:



      Filesystem Size Used Avail Capacity Mounted on /dev/disk0s2 595Gi 52Gi 544Gi 9% / devfs 181Ki 181Ki 0Bi 100% /dev map -hosts 0Bi 0Bi 0Bi 100% /net map auto_home 0Bi 0Bi 0Bi 100% /home

      Perintah lokal lainnya akan berjalan sesuai harapan. Untuk kembali ke sesi SFTP Anda, ketikkan:

      Sekarang Anda akan melihat prompt SFTP dihasilkan.

      Manipulasi Berkas secara Sederhana dengan SFTP

      SFTP memungkinkan Anda melakukan pemeliharaan berkas dasar yang berguna saat menangani hierarki berkas.

      Misalnya, Anda dapat mengubah pemilik berkas di sistem jauh dengan:

      Perhatikan, tidak seperti perintah chmod sistem, perintah SFTP tidak menerima nama pengguna, melainkan menggunakan UID. Sayangnya, tidak ada cara mudah untuk mengetahui UID yang sesuai dari dalam antarmuka SFTP.

      Solusi terkait dapat dilakukan dengan:

      • get /etc/passwd
      • !less passwd


      root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/bin/sh man:x:6:12:man:/var/cache/man:/bin/sh . . .

      Perhatikan, sebagai ganti memberikan perintah ! dengan sendirinya, kita menggunakannya sebagai awalan untuk perintah shell lokal. Cara ini berhasil untuk menjalankan perintah yang tersedia di mesin lokal kita dan dapat digunakan bersama perintah df lokal sebelumnya.

      UID akan berada di kolom ketiga berkas, seperti yang digambarkan melalui karakter titik dua.

      Demikian pula, kita dapat mengubah pemilik grup berkas dengan:

      Sekali lagi, tidak ada cara mudah untuk mendapatkan daftar grup sistem jauh. Kita dapat mengatasinya dengan perintah berikut:

      • get /etc/group
      • !less group


      root:x:0: daemon:x:1: bin:x:2: sys:x:3: adm:x:4: tty:x:5: disk:x:6: lp:x:7: . . .

      Kolom ketiga berisi ID grup yang dikaitkan dengan nama di kolom pertama. Inilah yang kita cari.

      Untungnya, perintah chmod berfungsi seperti yang diharapkan di sistem berkas jauh:


      Changing mode on /home/demouser/publicFile

      Tidak ada perintah untuk memanipulasi izin berkas lokal, tetapi Anda dapat mengatur umask lokal, sehingga berkas yang disalin ke sistem lokal akan memiliki izin yang sesuai.

      Hal itu dapat dilakukan dengan perintah lumask:


      Local umask: 022

      Sekarang semua berkas reguler yang diunduh (selama bendera -p tidak digunakan) akan memiliki 644 izin.

      SFTP memungkinkan Anda membuat direktori di sistem lokal maupun jauh masing-masing dengan lmkdir dan mkdir. Ini akan berhasil seperti yang diharapkan.

      Perintah berkas selebihnya hanya menargetkan sistem berkas jauh:

      Perintah ini menirukan perilaku dasar dari versi shell. Jika Anda perlu melakukan tindakan ini di sistem berkas lokal, ingatlah bahwa Anda dapat masuk ke shell dengan mengeluarkan perintah ini:

      Atau menjalankan perintah tunggal di sistem lokal dengan mengawali perintah itu menggunakan ! seperti ini:

      Bila Anda selesai dengan sesi SFTP, gunakan exit atau bye untuk menutup koneksi.


      Meskipun SFTP adalah alat sederhana, tetapi sangat berguna untuk administrasi server dan mentransfer berkas antar server.

      Misalnya, Anda dapat menggunakan SFTP untuk memungkinkan pengguna tertentu mentransfer berkas tanpa akses SSH. Untuk informasi lebih lanjut tentang proses ini, lihat tutorial kami tentang Cara Mengaktifkan SFTP Tanpa Akses Shell.

      Jika Anda biasa menggunakan FTP atau SCP untuk melakukan transfer, SFTP adalah cara yang tepat untuk memanfaatkan kekuatan keduanya. Walaupun tidak sesuai untuk setiap situasi, ini adalah alat fleksibel yang harus Anda gunakan dalam repertoar.

      Source link

      How To Set Up an Ubuntu 20.04 Server on a DigitalOcean Droplet


      In this guide, you will create an Ubuntu 20.04 server through DigitalOcean’s administrative panel and configure it to work with your SSH keys. Once you have your server set up, you can use it to deploy apps and websites.

      This tutorial is part of the Introduction to the Cloud Curriculum, which guides users through all the steps of securely deploying an application to the cloud. If you are searching for general documentation on DigitalOcean Droplets, please visit our product documentation How to Create a Droplet from the DigitalOcean Control Panel.


      Before you begin this guide, you’ll need the following:

      • Some familiarity with the command line. If you’d like an introduction or refresher to the command line, you can visit our Linux Command Line Primer (coming soon).
      • SSH keys to enable a secure connection with your server. To set up SSH keys via the command line, you can follow our guide How to Set Up SSH Keys on Ubuntu 20.04.
      • A credit card or PayPal account to set up a DigitalOcean Droplet. Note that the smallest Droplet offering can be used for this tutorial, whose monthly subscription fee is available on our Pricing page. Users can cancel their Droplet service at any time.

      Note: Eligible students can sign up to receive $50 in free credits for Digital Ocean through the GitHub Student Developer Pack.

      Step 1 — Creating a DigitalOcean account

      To access the DigitalOcean Control Panel and create a Droplet, you need a DigitalOcean account. To create a new account, navigate to the DigitalOcean new account registration page. You can choose to register through email, Google, or GitHub.

      After you’ve confirmed your account, you will need to enter your credit card or Paypal information. This information is collected to verify identity and keep spammers out. You will not be charged until you choose a plan and confirm your subscription, which we will cover in Step 4. You may see a temporary pre-authorization charge to verify the card, which will be reversed within a week.

      Once your information has been accepted, you will be taken to a window that says “Registration Complete”. You are now ready to proceed to the next step.

      Step 2 — Setting Up Your Droplet

      In the previous step, you should have been taken to a window that says “Registration Complete” with a “Let’s make something” button. Click on the “Let’s make something” button. The next window will display buttons for different Droplet options. Click on the “Go to Control Panel” link at the bottom:

      Webpage displaying Droplet options

      Once you click on the “Go to Control Panel” link, you will be taken to the control panel:

      Digital Ocean Cloud Control Panel

      Navigate to the “Create” menu in the upper right corner and click “Droplets” to open the Droplet create page. If you don’t have any Droplets, the Resources tab displays a large, blue “Get Started with a Droplet” button, which takes you to the same Droplet create page.

      The Droplet create page is where you choose your Droplet’s configuration, like its operating system, how much memory it has, and which features (like backups or monitoring) to enable.

      In the next step, you will choose an image of the operating system to be installed on your Droplet.

      Step 3 — Choosing an Image

      An image is a copy of an operating system. To create a Droplet, users need to pick an image of an operating system to run their server. DigitalOcean offers five different Linux operating system distributions. As this tutorial is for setting up an Ubuntu 20.04, click on the option for Ubuntu 20.04 (LTS) x 64:

      Options of images for Droplets

      After selecting your operating system, you are ready to proceed to the next step.

      Step 4 — Choosing a Plan

      In the Choose a plan section, you can choose the amount of RAM, storage space, and CPU cores your Droplet will have. If you are following this tutorial for the Introduction to the Cloud Curriculum, the Basic $5 per month plan will work for the Curriculum’s hands-on tutorials and exercises.

      Click on the option for the Basic $5/mo plan:

      Choose a plan secton

      After selecting a plan, you are ready to proceed to the next step.

      Step 5 — Adding Block Storage (Optional)

      This option allows users to add block storage as independent volumes that can be moved from one Droplet to another within the same region. Block storage is useful when you need additional file storage space for your Droplet. If you are following this tutorial for the Introduction to the Cloud Curriculum, you do not need to add block storage. Leave this option unselected unless you want to add block storage.

      You are now ready to proceed to the next step.

      Step 6 — Choosing a Datacenter Region

      In the Choose a datacenter region section, select the region where you want to create your Droplet.

      A good default will be preselected for you, but for the best performance and minimal latency, choose the datacenter nearest to you and your users.

      Datacenter region selections

      Once you have selected your datacenter, you are ready to proceed to the next step.

      Step 7 — Selecting Additional Options

      In the Select additional options section, you can enable several optional services that add functionality to your Droplet:

      Select additional options

      The three features available in this section are free, so enabling them does not increase the Droplet’s monthly cost. They can be understood as follows:

      IPv6 enables IPv6 access for your Droplet. IPv6 is the most recent version of the Internet Protocol, which identifies computers on networks and routes traffic across the Internet. IPv6 addresses provide more address space than their IPv4 counterparts, and are part of an effort to sustain the growth and deployment of Internet-ready devices.

      User data is arbitrary data that you specify which is written to the user-data field of the DigitalOcean metadata service. To learn more about the purpose of user data, you can visit the User Data product documentation.

      Monitoring adds the DigitalOcean agent to collect extended metrics and create alert policies. To learn more about monitoring, you can visit the Monitoring product documentation.

      You can leave these options blank unless you’d like to enable them. Once you’ve selected your desired options, you are ready to proceed to the next step.

      Step 8 — Setting Up SSH Authentication

      In this section, you will set up SSH authentication for your Droplet, using the pair of SSH keys you created as one of the prerequisites for this tutorial. If you did not already create SSH keys, there will be an opportunity to create them in just a few moments.

      Click on the option to use SSH keys for authentication, which is more secure than a password. Then click on the “New SSH Key” button:

      Authentication section of Droplet set up

      A pop up window will appear prompting you to copy your public SSH key and paste it in the provided space:

      Pop-up window for SSH key

      Note: If you have not created SSH keys, follow the directions on the right side of the pop-up window to create the keys or follow our guide How to Set Up SSH Keys on Ubuntu 20.04.

      To copy your public key, run the following command in your terminal:

      Copy the output from your terminal and paste it into the space provided by the cloud panel pop-up window. Then give your key a name so you can select it later on. When you have finished, click “Add new SSH key”. You will then return to the cloud panel where you can make sure your new key is selected.

      When you have selected your new key, you are ready to proceed to the next step.

      Step 9 — Finalizing and Creating Droplet

      In this final section of the Droplet creation process, you have the option to:

      • Select the number of Droplets you wish to create. If you are following this tutorial as part of the Introduction to the Cloud Curriculum, you need to only create one Droplet. Otherwise, select your desired amount of Droplets.
      • Name the Droplet. You can use the automatically-generated name or create your own name.
      • Add tags to help organize your Droplets. You can leave this option blank if you wish.
      • Assign your Droplet to a project to help with organization. A default folder will be created and selected here. You can create new folders later if you wish.
      • Add backups. This option enables a system-level backup of your Droplet to help prevent data loss. Note that choosing this option adds $1 to your cost per month. Choose this option if you wish.

      Finalizing and Creating Droplet <br>

      When you are finished making your choices, click “Create Droplet.” You will then be taken to a page showing a progress bar for the Droplet creation process. When the Droplet is ready, its IP address will be displayed:

      Droplet page

      You will use this IP address to securely connect with the Droplet through your terminal. Copy the IP address and then run the following command in your terminal to securely connect with your Droplet via SSH as a root user.

      The terminal will then display a message like this:


      The authenticity of host ' (' can't be established. ECDSA key fingerprint is SHA256:+Mx4ID5k4N8H7R24y+APZAoTe69hmAh9qMawyf/Lq9U. Are you sure you want to continue connecting (yes/no/[fingerprint])?

      Type yes. If you chose a passphrase when setting up SSH, you will be prompted to enter it here. If everything is working, you will then be logged into your Droplet as a root user. Note that it is strongly recommended to create a new user with lesser privileges for day-to-day use of your Droplet to avoid making irreparable changes. To create a new user, you can follow our Initial Server Setup guide, which is the next tutorial in the Introduction to the Cloud Curriculum.


      In this tutorial, you have set up an Ubuntu 20.04 server on a Droplet and enabled SSH access. To learn more about what you can do with this Droplet, you can visit our Introduction to the Cloud Curriculum.

      If you wish to delete your Droplet, you can visit our product documentation on How To Destroy a Droplet. To cancel your account, please follow the instructions on our Account Cancellation page.

      Source link