<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Shahidul Islam</title>
    <description>The latest articles on DEV Community by Muhammad Shahidul Islam (@muhammad_shahidulislam_b).</description>
    <link>https://dev.to/muhammad_shahidulislam_b</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2012255%2F94bfb053-a424-42c6-9ef9-0feaa1ab8156.jpg</url>
      <title>DEV Community: Muhammad Shahidul Islam</title>
      <link>https://dev.to/muhammad_shahidulislam_b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muhammad_shahidulislam_b"/>
    <language>en</language>
    <item>
      <title>CentOS Stream 9 : Initial Settings : Add User Accounts</title>
      <dc:creator>Muhammad Shahidul Islam</dc:creator>
      <pubDate>Thu, 28 Nov 2024 11:53:23 +0000</pubDate>
      <link>https://dev.to/muhammad_shahidulislam_b/centos-stream-9-initial-settings-add-user-accounts-4o1e</link>
      <guid>https://dev.to/muhammad_shahidulislam_b/centos-stream-9-initial-settings-add-user-accounts-4o1e</guid>
      <description>&lt;p&gt;To add user accounts on CentOS Stream Server, Configure like follows.&lt;br&gt;
[1] For example, Add [centos] user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[root@localhost ~]# useradd centos
[root@localhost ~]# passwd centos
Changing password for user centos.
New UNIX password:              # input any password you'd like to set
Retype new UNIX password:       # confirm
passwd: all authentication tokens updated successfully.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;[2] If you'd like to switch to root account from a user added above, use [su] command to do so.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;localhost login: centos         # login username
password:                       # input user password
[centos@localhost ~]$ su -      # switch to root
Password:                       # input root password
[root@localhost ~]#             # just switched to root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;[3] If you'd like to limit users to run [su] command, configure like follows.&lt;br&gt;
On the example below, only users in [wheel] group can run [su] command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[root@localhost ~]# usermod -aG wheel centos
[root@localhost ~]# vi /etc/pam.d/su
#%PAM-1.0
auth            sufficient      pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth           sufficient      pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
# uncomment the following line
auth            required        pam_wheel.so use_uid
auth            substack        system-auth
auth            include         postlogin
account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
account         include         system-auth
password        include         system-auth
session         include         system-auth
session         include         postlogin
session         optional        pam_xauth.so

# verify settings with a user who is not in allowed group
[redhat@localhost ~]$ su -
Password:
su: Permission denied     # denied normally
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;[4] If you'd like to remove a user accounts, Set like follows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# remove a user [centos] (only removed user account)
[root@localhost ~]# userdel centos
# remove a user [centos] (removed user account and his home directory both)
[root@localhost ~]# userdel -r centos
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>CentOS Stream 9 : Install Samba to Configure File Server.</title>
      <dc:creator>Muhammad Shahidul Islam</dc:creator>
      <pubDate>Thu, 28 Nov 2024 11:48:05 +0000</pubDate>
      <link>https://dev.to/muhammad_shahidulislam_b/centos-stream-9-install-samba-to-configure-file-server-4oh2</link>
      <guid>https://dev.to/muhammad_shahidulislam_b/centos-stream-9-install-samba-to-configure-file-server-4oh2</guid>
      <description>&lt;p&gt;For example, Create a fully accessed shared Folder which anybody can read and write, and also authentication is not required.&lt;br&gt;
[1] Install and Configure Samba.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[root@smb ~]# dnf -y install samba
[root@smb ~]# mkdir /home/share
[root@smb ~]# chmod 777 /home/share
[root@smb ~]# vi /etc/samba/smb.conf
[global]
        # line 11 : add (set charset)
        unix charset = UTF-8
        workgroup = SAMBA
        security = user
        # add IP addresses you allow to access
        hosts allow = 127. 10.0.0. 
        # add (no authentication)
        map to guest = Bad User

.....
.....

# add to the end
# any Share name you like
[Share]
        # specify shared directory
        path = /home/share
        # allow writing
        writable = yes
        # allow guest user (nobody)
        guest ok = yes
        # looks all as guest user
        guest only = yes
        # set permission [777] when file created
        force create mode = 777
        # set permission [777] when folder created
        force directory mode = 777 

[root@smb ~]# systemctl enable --now smb

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;[2] If SELinux is enabled and also use [/home] like this example, Change SELinux policy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
[root@smb ~]# setsebool -P samba_enable_home_dirs on
[root@smb ~]# restorecon -R /home/share
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;[3] If Firewalld is running, allow Samba service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[root@smb ~]# firewall-cmd --add-service=samba
success
[root@smb ~]# firewall-cmd --runtime-to-permanent
success
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>CentOS Stream 9 : Memcached : PHP</title>
      <dc:creator>Muhammad Shahidul Islam</dc:creator>
      <pubDate>Wed, 27 Nov 2024 08:01:48 +0000</pubDate>
      <link>https://dev.to/muhammad_shahidulislam_b/centos-stream-9-memcached-php-5del</link>
      <guid>https://dev.to/muhammad_shahidulislam_b/centos-stream-9-memcached-php-5del</guid>
      <description>&lt;p&gt;This is the example to use Memcached on PHP.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# install from EPEL, CRB
[root@localhost ~]# dnf --enablerepo=epel,crb -y install php-pecl-memcached
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the Basic usage on PHP.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[cent@dlp ~]$ vi use_memcache.php
&amp;lt;?php
$memcache = new Memcached();
$memcache-&amp;gt;addServer('localhost', 11211);
$memcache-&amp;gt;setOption(Memcached::OPT_COMPRESSION, false);

// set and get a Key
$memcache-&amp;gt;set('key01', 'value01');
print 'key01.value : ' . $memcache-&amp;gt;get('key01') . "\n";

// append and get a Key
$memcache-&amp;gt;append('key01', ',value02');
print 'key01.value : ' . $memcache-&amp;gt;get('key01') . "\n";

$memcache-&amp;gt;set('key02', 1);
print 'key02.value : ' . $memcache-&amp;gt;get('key02') . "\n";

// increment
$memcache-&amp;gt;increment('key02', 100);
print 'key02.value : ' . $memcache-&amp;gt;get('key02') . "\n";

// decrement
$memcache-&amp;gt;decrement('key02', 51);
print 'key02.value : ' . $memcache-&amp;gt;get('key02') . "\n";

?&amp;gt;

# run
[cent@localhost ~]$ php use_memcache.php
key01.value : value01
key01.value : value01,value02
key02.value : 1
key02.value : 101
key02.value : 50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.linkedin.com/in/shahidcse" rel="noopener noreferrer"&gt;LinkedIn &lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>CentOS Stream 9 : Memcached : Install</title>
      <dc:creator>Muhammad Shahidul Islam</dc:creator>
      <pubDate>Wed, 27 Nov 2024 07:53:53 +0000</pubDate>
      <link>https://dev.to/muhammad_shahidulislam_b/centos-stream-9-memcached-install-411p</link>
      <guid>https://dev.to/muhammad_shahidulislam_b/centos-stream-9-memcached-install-411p</guid>
      <description>&lt;p&gt;Install Memcached, which is the distributed memory caching system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install Memcached.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# install from EPEL, CRB
[root@localhost ~]# dnf --enablerepo=epel,crb -y install php-pecl-memcached
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;It's possible to change settings of Memcached on [/etc/sysconfig/memcached].&lt;br&gt;
For other options, you can see [man memcached].&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[root@localhost ~]# vi /etc/sysconfig/memcached
# listening port
PORT="11211"
# process owner
USER="memcached"
# max connections
MAXCONN="1024"
# max cache memory size (MB)
CACHESIZE="64"
# possible to specify options here
# listen on localhost by default like follows
# if you'd like to use memcached from other Hosts, change to own IP address or to [0.0.0.0]
OPTIONS="-l 127.0.0.1,::1"
[root@dlp ~]# systemctl enable --now memcached
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;If you'd like to use Memcached from other Hosts and also Firewalld is running, allow service.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[root@dlp ~]# firewall-cmd --add-service=memcache
success
[root@dlp ~]# firewall-cmd --runtime-to-permanent
success
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.linkedin.com/in/shahidcse" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
