[root@sftp ~]# groupadd sftp_users
[root@sftp ~]# useradd -G sftp_users -s /sbin/nologin sftp_user
[root@sftp ~]#
[root@sftp ~]# passwd sftp_user
Changing password for user sftp_user.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@sftp ~]#
[root@sftp ~]#
[root@sftp ~]# usermod -G sftp_users -s /sbin/nologin sftp_user
[root@sftp ~]# vim /etc/ssh/sshd_config
#comment out the below line and add a line like below
#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
# add Below lines at the end of file
Match Group sftp_users
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory %h
ForceCommand internal-sftp
ChrootDirectory %h – This is the path(default user’s home directory) that will be used for chroot after the user is authenticated. So, for sftp_user, this will be /home/sftp_user.
[root@sftp ~]# systemctl restart sshd.service
[root@sftp ~]# chmod 755 /home/sftp_user/
[root@sftp ~]# chmod 755 /home/sftp_user
[root@sftp ~]# chown root /home/sftp_user
[root@sftp ~]# chgrp -R sftp_users /home/sftp_user
[root@sftp ~]# mkdir /home/sftp_user/upload
[root@sftp ~]# chown sftp_user. /home/sftp_user/upload/
[root@sftp ~]#
[root@sftp ~]# setsebool -P ssh_chroot_full_access on
Boolean ssh_chroot_full_access is not defined
[root@sftp ~]#
[root@sftp ~]#
[root@sftp ~]#
[root@sftp ~]# ssh sftp_user@10.88.13.111
sftp_user@10.88.13.111's password:
This service allows sftp connections only.
Connection to 10.88.13.111 closed.
[root@sftp ~]# sftp sftp_user@10.88.13.111
sftp_user@10.88.13.111's password:
Connected to 10.88.13.111.
sftp> pwd
Remote working directory: /
sftp>
Tuesday, 15 March 2022
step by step configure sftp server in Linux
Sunday, 6 March 2022
step by step Oracle 12c Data Guard Failover
Step:1 In standby database check the database role and open_mode
SQL> SELECT OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE FROM V$DATABASE;
OPEN_MODE PROTECTION_MODE DATABASE_ROLE
-------------------- -------------------- ----------------
READ ONLY WITH APPLY MAXIMUM PERFORMANCE PHYSICAL STANDBY
Step:2 Check archive log gap sequence
SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;
no rows selected
Step:3 Cancel MRP process in standby database
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Database altered.
Step:4 Bring up standby database as primary
SQL> alter database recover managed standby database finish;
Database altered.
SQL> alter database activate standby database;
Database altered.
Managed recovery process has been stopped between primary and standby database and standby becomes primary database.
Step:5 Shutdown and startup database and verify database name its open mode and its role.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 1.6106E+11 bytes
Fixed Size 7653336 bytes
Variable Size 8.1604E+10 bytes
Database Buffers 7.8920E+10 bytes
Redo Buffers 529215488 bytes
Database mounted.
Database opened.
SQL> select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ WRITE PRIMARY
Sunday, 14 November 2021
step by step enable archivelog and flashback in Oracle 19c RAC Database
Step:-1 Before Changing the archivelog mode and Flashback Database check the status.
SQL> select log_mode,flashback_on from gv$database;
LOG_MODE FLASHBACK_ON
------------ ------------------
NOARCHIVELOG NO
NOARCHIVELOG NO
Step:-2 Stop the rac database service.
[oracle@bamisdbrac02 ~]$ srvctl status database -d misdbrac
Instance misdbrac1 is running on node bamisdbrac01
Instance misdbrac2 is running on node bamisdbrac02
[oracle@bamisdbrac02 ~]$
[oracle@bamisdbrac02 ~]$ srvctl stop database -d misdbrac
[oracle@bamisdbrac02 ~]$
Step:-3 Start the rac database in mount state.
[oracle@bamisdbrac02 ~]$ sqlplus
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Nov 14 19:02:36 2021
Version 19.12.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 6.4425E+10 bytes
Fixed Size 37476752 bytes
Variable Size 1.0872E+10 bytes
Database Buffers 5.3419E+10 bytes
Redo Buffers 96739328 bytes
Database mounted.
SQL>
[oracle@bamisdbrac01 ~]$ sqlplus
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Nov 14 19:02:04 2021
Version 19.12.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 6.4425E+10 bytes
Fixed Size 37476752 bytes
Variable Size 1.0335E+10 bytes
Database Buffers 5.3956E+10 bytes
Redo Buffers 96739328 bytes
Database mounted.
SQL>
Step:-4 Enable archive log mode and Flashback database
[oracle@bamisdbrac02 ~]$ srvctl status database -d misdbrac
Instance misdbrac1 is running on node bamisdbrac01
Instance misdbrac2 is running on node bamisdbrac02
[oracle@bamisdbrac02 ~]$
SQL> select FLASHBACK_ON from v$database;
FLASHBACK_ON
------------------
NO
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /u01/app/oracle/product/19.3/db_1/dbs/arch
Oldest online log sequence 1772
Current log sequence 1773
SQL> select log_mode,flashback_on from gv$database;
LOG_MODE FLASHBACK_ON
------------ ------------------
NOARCHIVELOG NO
NOARCHIVELOG NO
SQL>
alter system set log_archive_dest_1='LOCATION=+FRA/' scope=both sid='*';
alter database archivelog;
alter system set db_recovery_file_dest_size=500G scope=both sid='*';
alter system set db_recovery_file_dest='+FRA' scope=both sid='*';
alter database flashback on;
Step:-5 Stop the RAC database service
[oracle@bamisdbrac02 ~]$ srvctl stop database -d misdbrac
Step:-6 Restart the RAC database
[oracle@bamisdbrac02 ~]$ srvctl start database -d misdbrac
[oracle@bamisdbrac02 ~]$ srvctl status database -d misdbrac
Instance misdbrac1 is running on node bamisdbrac01
Instance misdbrac2 is running on node bamisdbrac02
[oracle@bamisdbrac02 ~]$
Step:-7 Check Archivelog and flashback Status
SQL> select log_mode,flashback_on from gv$database;
LOG_MODE FLASHBACK_ON
------------ ------------------
ARCHIVELOG YES
ARCHIVELOG YES
SQL>
[oracle@bamisdbrac02 ~]$ sqlplus
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Nov 14 19:11:38 2021
Version 19.12.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.12.0.0.0
SQL> select log_mode,flashback_on from gv$database;
LOG_MODE FLASHBACK_ON
ARCHIVELOG YES
ARCHIVELOG YES
SQL>