{"id":6276,"date":"2026-01-27T11:14:57","date_gmt":"2026-01-27T11:14:57","guid":{"rendered":"https:\/\/commandlinux.com\/?p=6276"},"modified":"2026-01-27T11:15:02","modified_gmt":"2026-01-27T11:15:02","slug":"chmod-executable","status":"publish","type":"post","link":"https:\/\/commandlinux.com\/how-to\/chmod-executable\/","title":{"rendered":"How to Use chmod Executable in Linux"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <style>\n       \n        code {\n            font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Droid Sans Mono', monospace;\n            font-size: 0.9em;\n            background: #f7fafc;\n            padding: 2px 6px;\n            border-radius: 3px;\n            color: #e53e3e;\n        }\n        \n        pre {\n            background: #f7fafc;\n            border: 1px solid #e2e8f0;\n            border-radius: 6px;\n            padding: 16px;\n            overflow-x: auto;\n            margin: 16px 0;\n            font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;\n            font-size: 0.9em;\n            line-height: 1.6;\n        }\n        \n        pre code {\n            background: none;\n            padding: 0;\n            color: #2d3748;\n        }\n        \n        table {\n            width: 100%;\n            border-collapse: collapse;\n            margin: 20px 0;\n            font-size: 0.95em;\n        }\n        \n        th {\n            background: #edf2f7;\n            padding: 12px;\n            text-align: left;\n            font-weight: 600;\n            border: 1px solid #cbd5e0;\n        }\n        \n        td {\n            padding: 12px;\n            border: 1px solid #e2e8f0;\n        }\n        \n        .note {\n            background: #ebf8ff;\n            border-left: 4px solid #3182ce;\n            padding: 16px;\n            margin: 20px 0;\n            border-radius: 4px;\n        }\n        \n        .note strong {\n            color: #2c5282;\n        }\n        \n        .warning {\n            background: #fff5f5;\n            border-left: 4px solid #e53e3e;\n            padding: 16px;\n            margin: 20px 0;\n            border-radius: 4px;\n        }\n        \n        .warning strong {\n            color: #c53030;\n        }\n        \n        .tip {\n            background: #f0fff4;\n            border-left: 4px solid #38a169;\n            padding: 16px;\n            margin: 20px 0;\n            border-radius: 4px;\n        }\n        \n        .tip strong {\n            color: #276749;\n        }\n        \n        .faq-section {\n            margin-top: 48px;\n        }\n        \n        .faq-item {\n            border: 1px solid #e2e8f0;\n            border-radius: 6px;\n            margin-bottom: 12px;\n            overflow: hidden;\n        }\n        \n        .faq-item input[type=\"checkbox\"] {\n            display: none;\n        }\n        \n        .faq-item label {\n            display: block;\n            padding: 16px 20px;\n            cursor: pointer;\n            background: #f7fafc;\n            position: relative;\n            transition: background 0.2s;\n        }\n        \n        .faq-item label:hover {\n            background: #edf2f7;\n        }\n        \n        .faq-item label h3 {\n            margin: 0;\n            font-size: 1.1rem;\n            font-weight: 600;\n            padding-right: 30px;\n        }\n        \n        .faq-item label::after {\n            content: '+';\n            position: absolute;\n            right: 20px;\n            top: 50%;\n            transform: translateY(-50%);\n            font-size: 1.5rem;\n            font-weight: 300;\n            transition: transform 0.3s;\n        }\n        \n        .faq-item input[type=\"checkbox\"]:checked + label::after {\n            transform: translateY(-50%) rotate(45deg);\n        }\n        \n        .faq-answer {\n            max-height: 0;\n            overflow: hidden;\n            transition: max-height 0.3s ease;\n        }\n        \n        .faq-item input[type=\"checkbox\"]:checked ~ .faq-answer {\n            max-height: 500px;\n        }\n        \n        .faq-answer p {\n            padding: 16px 20px;\n            margin: 0;\n            background: #ffffff;\n        }\n    <\/style>\n<\/head>\n<body>\n\n<p>The <code>chmod<\/code> command controls file permissions in Linux. The execute permission allows users to run scripts and programs. This guide shows how to use chmod executable to manage these permissions.<\/p>\n\n<p>Apply the command with mode 755 to a file:<\/p>\n\n<pre><code>$ chmod 755 script.sh<\/code><\/pre>\n\n<p>The breakdown shows owner with full access, group with read and execute, and others with read and execute.<\/p>\n\n<h3>Syntax of the chmod Command<\/h3>\n\n<pre><code>chmod [options] [mode] [file_name]<\/code><\/pre>\n\n<p>The mode represents permissions as a three-digit number or symbolic notation like <code>u+x<\/code>. The file_name identifies the target file or directory.<\/p>\n\n<h3>Common Permission Modes<\/h3>\n\n<table>\n    <thead>\n        <tr>\n            <th>Mode<\/th>\n            <th>Owner<\/th>\n            <th>Group<\/th>\n            <th>Others<\/th>\n            <th>Use Case<\/th>\n        <\/tr>\n    <\/thead>\n    <tbody>\n        <tr>\n            <td>700<\/td>\n            <td>rwx<\/td>\n            <td>&#8212;<\/td>\n            <td>&#8212;<\/td>\n            <td>Private scripts only you can run<\/td>\n        <\/tr>\n        <tr>\n            <td>750<\/td>\n            <td>rwx<\/td>\n            <td>r-x<\/td>\n            <td>&#8212;<\/td>\n            <td>Team-only executable<\/td>\n        <\/tr>\n        <tr>\n            <td>755<\/td>\n            <td>rwx<\/td>\n            <td>r-x<\/td>\n            <td>r-x<\/td>\n            <td>Everyone can run, owner edits<\/td>\n        <\/tr>\n        <tr>\n            <td>775<\/td>\n            <td>rwx<\/td>\n            <td>rwx<\/td>\n            <td>r-x<\/td>\n            <td>Group collaboration<\/td>\n        <\/tr>\n    <\/tbody>\n<\/table>\n\n<div class=\"note\">\n    <strong>Note:<\/strong> The recursive flag <code>-R<\/code> applies chmod executable permissions to all files in a directory structure.\n<\/div>\n\n<h2>Permission Types in Linux<\/h2>\n\n<p>Linux assigns three permission types to each file. Read allows viewing contents. Write enables modifications. Execute lets users run the file as a program.<\/p>\n\n<p>Each permission applies to three categories: owner, group, and others. The owner created the file. The group includes members with shared access. Others represents all remaining users.<\/p>\n\n<h3>Using Octal Notation<\/h3>\n\n<p>Octal mode uses numbers to represent permissions. Each digit corresponds to a permission level.<\/p>\n\n<table>\n    <thead>\n        <tr>\n            <th>Value<\/th>\n            <th>Permission<\/th>\n            <th>Binary<\/th>\n        <\/tr>\n    <\/thead>\n    <tbody>\n        <tr>\n            <td>4<\/td>\n            <td>Read<\/td>\n            <td>100<\/td>\n        <\/tr>\n        <tr>\n            <td>2<\/td>\n            <td>Write<\/td>\n            <td>010<\/td>\n        <\/tr>\n        <tr>\n            <td>1<\/td>\n            <td>Execute<\/td>\n            <td>001<\/td>\n        <\/tr>\n    <\/tbody>\n<\/table>\n\n<p>Add values together for combined permissions. The value 7 grants all permissions (4+2+1). The value 5 grants read and execute (4+1).<\/p>\n\n<p>Grant the owner full access, group read and write, and others read only:<\/p>\n\n<pre><code>$ chmod 764 document.txt<\/code><\/pre>\n\n<h3>Using Symbolic Notation<\/h3>\n\n<p>Symbolic mode uses letters instead of numbers. The format combines who, action, and permission.<\/p>\n\n<p>Categories include <code>u<\/code> for user, <code>g<\/code> for group, <code>o<\/code> for others, and <code>a<\/code> for all. Actions include <code>+<\/code> to add, <code>-<\/code> to remove, and <code>=<\/code> to set exactly.<\/p>\n\n<p>Add execute permission for the owner:<\/p>\n\n<pre><code>$ chmod u+x script.sh<\/code><\/pre>\n\n<p>Remove write permission from others:<\/p>\n\n<pre><code>$ chmod o-w file.txt<\/code><\/pre>\n\n<div class=\"tip\">\n    <strong>Tip:<\/strong> Use symbolic notation for single permission changes and octal notation when setting multiple permissions at once.\n<\/div>\n\n<h3>Reverting Permission Changes<\/h3>\n\n<p>Reset permissions by applying the correct mode again. Check current permissions first with <code>ls -l<\/code>.<\/p>\n\n<p>Restore standard file permissions (owner read-write, others read-only):<\/p>\n\n<pre><code>$ chmod 644 file.txt<\/code><\/pre>\n\n<h2>Making Scripts Executable in Linux<\/h2>\n\n<p>Scripts require execute permission to run. Without this permission, Linux blocks execution. Follow these steps to make a script executable.<\/p>\n\n<h3>Step 1: Navigate to the Script Directory<\/h3>\n\n<p>Move to the directory containing your script:<\/p>\n\n<pre><code>$ cd \/path\/to\/script<\/code><\/pre>\n\n<h3>Step 2: Check Current Permissions<\/h3>\n\n<p>View existing permissions with the <code>ls<\/code> command:<\/p>\n\n<pre><code>$ ls -l script.sh<\/code><\/pre>\n\n<p>The output displays permissions in the first column. Look for the x character in the permission string.<\/p>\n\n<h3>Step 3: Add Execute Permission<\/h3>\n\n<p>Apply the chmod executable command to the script:<\/p>\n\n<pre><code>$ chmod +x script.sh<\/code><\/pre>\n\n<p>This adds execute permission for all users. For owner-only execution, use:<\/p>\n\n<pre><code>$ chmod u+x script.sh<\/code><\/pre>\n\n<div class=\"warning\">\n    <strong>Warning:<\/strong> Granting execute permission to all users on system files creates security risks. Apply permissions carefully.\n<\/div>\n\n<h3>Step 4: Verify the Changes<\/h3>\n\n<p>Confirm the permission change worked:<\/p>\n\n<pre><code>$ ls -l script.sh<\/code><\/pre>\n\n<p>The permission string now shows x in the execute position.<\/p>\n\n<h3>Step 5: Run the Script<\/h3>\n\n<p>Execute the script using the current directory notation:<\/p>\n\n<pre><code>$ .\/script.sh<\/code><\/pre>\n\n<p>The dot-slash prefix tells Linux to look in the current directory for the file.<\/p>\n\n<h2>Practical Applications<\/h2>\n\n<p>Apply chmod executable to automation scripts that run scheduled tasks. Set mode 700 for scripts containing sensitive operations.<\/p>\n\n<p>For shared team scripts, use mode 750. This allows team members to execute while preventing modifications from unauthorized users.<\/p>\n\n<p>System-wide utilities need mode 755. This grants universal execute access while restricting modifications to the owner.<\/p>\n\n<div class=\"note\">\n    <strong>Note:<\/strong> Verify script functionality in a test environment before applying chmod executable permissions in production.\n<\/div>\n\n<div class=\"faq-section\">\n    <h2>FAQs<\/h2>\n    \n    <div class=\"faq-item\">\n        <input type=\"checkbox\" id=\"faq1\">\n        <label for=\"faq1\"><h3>What does chmod +x do in Linux?<\/h3><\/label>\n        <div class=\"faq-answer\">\n            <p>The chmod +x command adds execute permission to a file for all users. This allows the file to run as a program or script directly from the terminal.<\/p>\n        <\/div>\n    <\/div>\n    \n    <div class=\"faq-item\">\n        <input type=\"checkbox\" id=\"faq2\">\n        <label for=\"faq2\"><h3>How do I make a file executable for only the owner?<\/h3><\/label>\n        <div class=\"faq-answer\">\n            <p>Use chmod u+x filename to add execute permission only for the owner. This restricts script execution to the file owner while blocking group members and others.<\/p>\n        <\/div>\n    <\/div>\n    \n    <div class=\"faq-item\">\n        <input type=\"checkbox\" id=\"faq3\">\n        <label for=\"faq3\">How do I remove executable permissions with chmod?<\/h3><\/label>\n        <div class=\"faq-answer\">\n            <p>Run chmod -x filename to remove execute permission from all users. For specific categories, use chmod u-x, chmod g-x, or chmod o-x for owner, group, or others.<\/p>\n        <\/div>\n    <\/div>\n    \n    <div class=\"faq-item\">\n        <input type=\"checkbox\" id=\"faq4\">\n        <label for=\"faq4\"><h3>What is the difference between chmod 755 and 777?<\/h3><\/label>\n        <div class=\"faq-answer\">\n            <p>Mode 755 gives full access to owner, read-execute to others. Mode 777 grants full access to everyone. Avoid 777 as it creates security vulnerabilities on systems.<\/p>\n        <\/div>\n    <\/div>\n    \n    <div class=\"faq-item\">\n        <input type=\"checkbox\" id=\"faq5\">\n        <label for=\"faq5\"><h3>Can I use chmod executable on directories?<\/h3><\/label>\n        <div class=\"faq-answer\">\n            <p>Yes, execute permission on directories allows users to access the directory contents. Use chmod +x directory_name or apply recursively with chmod -R +x to all subdirectories.<\/p>\n        <\/div>\n    <\/div>\n<\/div>\n\n<\/body>\n<\/html>\n\n\n","protected":false},"excerpt":{"rendered":"<p>The chmod command controls file permissions in Linux. The execute permission allows users to run scripts and programs. This guide shows how to use chmod executable to manage these permissions. Apply the command with mode 755 to a file: $ chmod 755 script.sh The breakdown shows owner with full access, group with read and execute,<\/p>\n","protected":false},"author":1,"featured_media":6277,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[],"class_list":["post-6276","post","type-post","status-publish","format-standard","has-post-thumbnail","category-how-to"],"_links":{"self":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/6276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/comments?post=6276"}],"version-history":[{"count":1,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/6276\/revisions"}],"predecessor-version":[{"id":6278,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/posts\/6276\/revisions\/6278"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/media\/6277"}],"wp:attachment":[{"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/media?parent=6276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/categories?post=6276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/commandlinux.com\/wp-json\/wp\/v2\/tags?post=6276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}