When first discretizing equations, it's useful to draw a diagram showing where the data lives relative to physical boundaries. Here are some schematics for visual aid:
Applying finite difference to a differential equation takes a different form for cell-centered (CC) and node (N) data.
--------------------------------------------------------------------------------------------------------------------------------
Node data
Consider N data.
Consider the Laplace stencil operating on data $u$ with $f$ on the right-hand side (RHS),
\begin{equation}
\left(\frac{\partial^2 u}{\partial x^2}\right)_{boundary} =
\frac{u_g - 2 u_b + u_i}{\Delta x^2} = f_b
\end{equation}
Where $u_g,u_b,u_i$ are the ghost, boundary and first interior node points. This Laplacian operator may be written in matrix form as
$
A = \frac{1}{\Delta x^2} \left[\begin{array}{ccccccccc}
0 & 0 & 0 & & & & & & 0 \\
1 & -2 & 1 & & & & & & \\
0 & 1 & -2 & 1 & & & & & \\
& & & \ddots & \ddots & \ddots & & & \\
& & & & & 1 & -2 & 1 & 0 \\
& & & & & & 1 & -2 & 1 \\
0 & & & & & & 0 & 0 & 0 \\
\end{array} \right]
$
Note that this stencil reaches to the ghost points.
Dirichlet BCs
Consider Dirichlet BCs, $u_b$ is known, and the solve is only from $u_i$ onward. Therefore, the only equation we must consider is at location $i$:
\begin{equation}
\left(\frac{\partial^2 u}{\partial x^2}\right)_{i} = \frac{u_b - 2 u_i + u_{i+1}}{\Delta x^2} = f_i
\end{equation}
If we were to write an equation for the boundary point, we could write
\begin{equation}
\left(\frac{\partial^2 u}{\partial x^2}\right)_{b} = \frac{u_g - 2 u_b + u_{i}}{\Delta x^2} = f_b \rightarrow u_g = 2 u_b - u_{i} - \Delta x^2 f_b
\end{equation}
If we insist $f_b=0$ then we have a simplified version:
\begin{equation}
u_g = 2 u_b - u_{i}
\end{equation}
So the equation changes to
\begin{equation}
\left(\frac{\partial^2 u}{\partial x^2}\right)_{b} = 0 = 0
\end{equation}
And we may remove it from our system. Looking back the first interior point, let's move boundary value to the RHS:
\begin{equation}
\left(\frac{\partial^2 u}{\partial x^2}\right)_{i} = \frac{u_b - 2 u_i + u_{i+1}}{\Delta x^2} = f_i \rightarrow \frac{- 2 u_i + u_{i+1}}{\Delta x^2} = f_i - \frac{u_b}{\Delta x^2}
\end{equation}
This means that the ghost point should not enter the computations at all. They are a means to an end to apply the desired BCs. Correspondingly, the matrix $A$ is:
$
A = \frac{1}{\Delta x^2} \left[\begin{array}{ccccccccc}
0 & 0 & 0 & & & & & & 0 \\
1 & -2 & 1 & & & & & & \\
0 & 1 & -2 & 1 & & & & & \\
& & & \ddots & \ddots & \ddots & & & \\
& & & & & 1 & -2 & 1 & 0 \\
& & & & & & 1 & -2 & 1 \\
0 & & & & & & 0 & 0 & 0 \\
\end{array} \right]
\\ \rightarrow
A = \frac{1}{\Delta x^2} \left[\begin{array}{ccccccccc}
0 & 0 & 0 & & & & & & 0 \\
0 & 0 & 0 & & & & & & \\
0 & \textbf{0} & -2 & 1 & & & & & \\
0 & 0 & 1 & -2 & & & & & \\
& & & \ddots & \ddots & \ddots & & & \\
& & & & & -2 & 1 & 0 & 0 \\
& & & & & 1 & -2 & \textbf{0} & 0 \\
0 & & & & & & 0 & 0 & 0 \\
0 & & & & & & 0 & 0 & 0 \\
\end{array} \right]
$
This is nice because the equation has effectively become smaller. NOTE: the first two 0's in the above equation refer to the ghost and boundary equations.
Result
As you can see, this "truncation" of the first and last column in $A$ will effectively apply Dirichlet BCs to our system, so long $u_b$ is in fact zero, so this only works for a special case.
--------------------------------------------------------------------------------------------------------------------------------
Cell-Centered data
Consider the Laplace stencil operating on data $u$ with $f$ on the right-hand side (RHS),
\begin{equation}
\left(\frac{\partial^2 u}{\partial x^2}\right)_{1} = \frac{u_g - 2 u_1 + u_{2}}{\Delta x^2} = f_1
\end{equation}
Where $u_g,u_1,u_2$ are the ghost, first interior and second interior cells. This Laplacian operator may be written in matrix form as
$
A = \frac{1}{\Delta x^2} \left[\begin{array}{ccccccccc}
1 & 1 & & & & & & & 0 \\
1 & -2 & 1 & & & & & & \\
& 1 & -2 & 1 & & & & & \\
& & & \ddots & \ddots & \ddots & & & \\
& & & & & 1 & -2 & 1 & \\
& & & & & & 1 & -2 & 1 \\
0 & & & & & & & 1 & 1 \\
\end{array} \right]
$
Let's substitute $u_g$ and adjust the stencil accordingly.
Dirichlet
Consider Dirichlet BCs, $u_g$ may be computed observing that the boundary value is the average of the neighboring two cell center values.
\begin{equation}
u_b = \frac{u_g + u_1}{2} \rightarrow u_g = 2u_b - u_1
\end{equation}
So our Laplacian stencil becomes:
\begin{equation}
\left(\frac{\partial^2 u}{\partial x^2}\right)_{1} = \frac{(2 u_b - u_1) - 2 u_1 + u_{2}}{\Delta x^2} = f_1
\end{equation}
This boundary point must be moved to the RHS to maintain a consistent matrix-vector multiplication. Therefore our equation changes:
\begin{equation}
\frac{u_g - 2 u_1 + u_{2}}{\Delta x^2} = f_1 \rightarrow \frac{- 3 u_1 + u_{2}}{\Delta x^2} = f_1 - \frac{2 u_b}{\Delta x^2}
\end{equation}
Correspondingly, the matrix $A$ changes:
$
A = \frac{1}{\Delta x^2} \left[\begin{array}{ccccccccc}
1 & 1 & & & & & & & 0 \\
1 & -2 & 1 & & & & & & \\
& 1 & -2 & 1 & & & & & \\
& & & \ddots & \ddots & \ddots & & & \\
& & & & & 1 & -2 & 1 & \\
& & & & & & 1 & -2 & 1 \\
0 & & & & & & & 1 & 1 \\
\end{array} \right]
\\ \rightarrow
A = \frac{1}{\Delta x^2} \left[\begin{array}{ccccccccc}
0 & 0 & 0 & & & & & & 0 \\
0 & -3 & 1 & & & & & & \\
0 & 1 & -2 & 1 & & & & & \\
& & & \ddots & \ddots & \ddots & & & \\
& & & & & 1 & -2 & 1 & 0 \\
& & & & & & 1 & -3 & 0 \\
0 & & & & & & 0 & 0 & 0 \\
\end{array} \right]
$
Note that the first and last equations are identities ($0=0$) which are reserved for the ghost points.
Result
So, I stand corrected with my comment (on the OP's question) about assuming cell centered data. This "truncation" only works in a special case for Node data.